From eb2d695cbcf1e3bbf2cf750ba817fb09b0ad6265 Mon Sep 17 00:00:00 2001 From: qiwang <1364512070@qq.com> Date: Mon, 25 Mar 2024 19:09:15 +0800 Subject: [PATCH 1/4] fix:Modify configuration file fields Former-commit-id: ecd908cee464900c0d86d0dd10efebb3eed88469 --- api/desc/participant/pcm-participant.api | 12 +- api/desc/pcm.api | 4 +- api/desc/vm/pcm-vm.api | 4 +- .../handler/adapters/adapterslisthandler.go | 12 +- .../handler/adapters/clusterlisthandler.go | 12 +- .../handler/adapters/createadapterhandler.go | 12 +- .../handler/adapters/createclusterhandler.go | 12 +- .../handler/adapters/deleteadapterhandler.go | 12 +- .../handler/adapters/deleteclusterhandler.go | 12 +- .../handler/adapters/getadapterhandler.go | 12 +- .../adapters/getadapterrelationhandler.go | 12 +- .../handler/adapters/getclusterhandler.go | 12 +- .../handler/adapters/getclustersumhandler.go | 12 +- .../handler/adapters/updateadapterhandler.go | 12 +- .../handler/adapters/updateclusterhandler.go | 12 +- .../handler/core/centerresourceshandler.go | 8 +- .../handler/core/committaskhandler.go | 7 +- .../handler/core/commitvmtaskhandler.go | 12 +- .../handler/core/deletetaskhandler.go | 21 +-- .../core/getcomputilitystatisticshandler.go | 14 -- .../handler/core/getcomputingpowerhandler.go | 14 -- .../handler/core/getgeneralinfohandler.go | 14 -- api/internal/handler/core/getregionhandler.go | 14 -- .../core/getresourcepanelconfighandler.go | 23 +--- api/internal/handler/core/jobtotalhandler.go | 22 +-- .../handler/core/listcenterhandler.go | 14 -- .../handler/core/listclusterhandler.go | 14 -- .../handler/core/listdomainresourcehandler.go | 23 +--- .../handler/core/listregionhandler.go | 14 -- api/internal/handler/core/metricshandler.go | 13 +- .../handler/core/nodeassetshandler.go | 22 +-- .../handler/core/participantlisthandler.go | 22 +-- .../handler/core/pulltaskinfohandler.go | 4 +- .../handler/core/pushtaskinfohandler.go | 4 +- .../core/putresourcepanelconfighandler.go | 24 +--- .../handler/core/scheduletaskbyyamlhandler.go | 38 ++---- .../handler/core/syncclusterloadhandler.go | 7 +- .../handler/core/taskdetailhandler.go | 21 +-- api/internal/handler/core/tasklisthandler.go | 14 -- .../handler/dictionary/adddicthandler.go | 12 +- .../handler/dictionary/adddictitemhandler.go | 12 +- .../handler/dictionary/deletedicthandler.go | 12 +- .../dictionary/deletedictitemhandler.go | 12 +- .../handler/dictionary/editdicthandler.go | 12 +- .../handler/dictionary/editdictitemhandler.go | 12 +- .../handler/dictionary/getdicthandler.go | 12 +- .../handler/dictionary/getdictitemhandler.go | 12 +- .../handler/dictionary/listdicthandler.go | 12 +- .../dictionary/listdictitembycodehandler.go | 12 +- .../handler/dictionary/listdictitemhandler.go | 12 +- api/internal/types/types.go | 125 +++++++++++++++++- 51 files changed, 408 insertions(+), 396 deletions(-) diff --git a/api/desc/participant/pcm-participant.api b/api/desc/participant/pcm-participant.api index f76fc604..f77be78e 100644 --- a/api/desc/participant/pcm-participant.api +++ b/api/desc/participant/pcm-participant.api @@ -109,15 +109,15 @@ type VmInfo struct { type PushTaskInfoReq struct { AdapterId int64 `json:"adapterId"` - HpcInfoList []*HpcInfo - CloudInfoList []*CloudInfo - AiInfoList []*AiInfo - VmInfoList []*VmInfo + HpcInfoList []*HpcInfo `json:"hpcInfoList"` + CloudInfoList []*CloudInfo `json:"cloudInfoList"` + AiInfoList []*AiInfo `json:"aiInfoList"` + VmInfoList []*VmInfo `json:"vmInfoList"` } type PushTaskInfoResp struct { - Code int64 - Msg string + Code int64 `json:"code"` + Msg string `json:"msg"` } type PushResourceInfoReq struct { diff --git a/api/desc/pcm.api b/api/desc/pcm.api index df0d8643..63fe0d68 100644 --- a/api/desc/pcm.api +++ b/api/desc/pcm.api @@ -301,9 +301,9 @@ service pcm { @doc "挂载notebook存储" @handler mountNotebookStorageHandler post /ai/mountNotebookStorage (MountNotebookStorageReq) returns (MountNotebookStorageResp) -/******************Notebook Method end*************************/ + /******************Notebook Method end*************************/ -/******************Visualization Job Method start*************************/ + /******************Visualization Job Method start*************************/ @doc "获取虚拟化任务" @handler getVisualizationJobHandler get /ai/getVisualizationJob (GetVisualizationJobReq) returns (GetVisualizationJobResp) diff --git a/api/desc/vm/pcm-vm.api b/api/desc/vm/pcm-vm.api index 5640456b..cb605840 100644 --- a/api/desc/vm/pcm-vm.api +++ b/api/desc/vm/pcm-vm.api @@ -332,10 +332,12 @@ type ( Server { Name string `json:"name,optional" copier:"Name"` FlavorRef string `json:"flavorRef,optional" copier:"FlavorRef"` + Description string `json:"description,optional" copier:"Description"` ImageRef string `json:"imageRef,optional" copier:"ImageRef"` Networks []CreNetwork `json:"networks,optional" copier:"Networks"` //AdminPass string `json:"adminPass" copier:"AdminPass"` BlockDeviceMappingV2 []Block_device_mapping_v2 `json:"block_device_mapping_v2,optional" copier:"BlockDeviceMappingV2"` + MinCount int32 `json:"min_count,optional" copier:"MinCount"` } CreNetwork { Uuid string `json:"uuid" copier:"Uuid"` @@ -714,7 +716,7 @@ type ( Ipv6AddressScope string `json:"ipv6_address_scope,optional" copier:"Ipv6AddressScope"` L2Adjacency bool `json:"l2_adjacency,optional" copier:"L2Adjacency"` Mtu int64 `json:"mtu,optional" copier:"Mtu"` - Name string `json:",optional" copier:"Name"` + Name string `json:"name,optional" copier:"Name"` PortSecurityEnabled bool `json:"port_security_enabled,optional" copier:"PortSecurityEnabled"` ProjectId string `json:"project_id,optional" copier:"ProjectId"` QosPolicyId string `json:"qos_policy_id,optional" copier:"QosPolicyId"` diff --git a/api/internal/handler/adapters/adapterslisthandler.go b/api/internal/handler/adapters/adapterslisthandler.go index 6ae5c320..3d84c0c8 100644 --- a/api/internal/handler/adapters/adapterslisthandler.go +++ b/api/internal/handler/adapters/adapterslisthandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "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/repository/result" - "net/http" ) func AdaptersListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AdapterQueryReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewAdaptersListLogic(r.Context(), svcCtx) resp, err := l.AdaptersList(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/clusterlisthandler.go b/api/internal/handler/adapters/clusterlisthandler.go index bf168fbc..f1863304 100644 --- a/api/internal/handler/adapters/clusterlisthandler.go +++ b/api/internal/handler/adapters/clusterlisthandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "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/repository/result" - "net/http" ) func ClusterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ClusterReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewClusterListLogic(r.Context(), svcCtx) resp, err := l.ClusterList(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/createadapterhandler.go b/api/internal/handler/adapters/createadapterhandler.go index be20ca49..42b60968 100644 --- a/api/internal/handler/adapters/createadapterhandler.go +++ b/api/internal/handler/adapters/createadapterhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "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/repository/result" - "net/http" ) func CreateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AdapterCreateReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewCreateAdapterLogic(r.Context(), svcCtx) resp, err := l.CreateAdapter(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/createclusterhandler.go b/api/internal/handler/adapters/createclusterhandler.go index 47e1e8b6..80eaa0de 100644 --- a/api/internal/handler/adapters/createclusterhandler.go +++ b/api/internal/handler/adapters/createclusterhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "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/repository/result" - "net/http" ) func CreateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ClusterCreateReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewCreateClusterLogic(r.Context(), svcCtx) resp, err := l.CreateCluster(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/deleteadapterhandler.go b/api/internal/handler/adapters/deleteadapterhandler.go index 3b2fb374..b2e1c7ca 100644 --- a/api/internal/handler/adapters/deleteadapterhandler.go +++ b/api/internal/handler/adapters/deleteadapterhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "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/repository/result" - "net/http" ) func DeleteAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AdapterDelReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewDeleteAdapterLogic(r.Context(), svcCtx) resp, err := l.DeleteAdapter(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/deleteclusterhandler.go b/api/internal/handler/adapters/deleteclusterhandler.go index 2f9d3c9e..62e800f1 100644 --- a/api/internal/handler/adapters/deleteclusterhandler.go +++ b/api/internal/handler/adapters/deleteclusterhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "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/repository/result" - "net/http" ) func DeleteClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.FId if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewDeleteClusterLogic(r.Context(), svcCtx) resp, err := l.DeleteCluster(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/getadapterhandler.go b/api/internal/handler/adapters/getadapterhandler.go index 3967cc56..2e4e189d 100644 --- a/api/internal/handler/adapters/getadapterhandler.go +++ b/api/internal/handler/adapters/getadapterhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "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/repository/result" - "net/http" ) func GetAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AdapterDelReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewGetAdapterLogic(r.Context(), svcCtx) resp, err := l.GetAdapter(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/getadapterrelationhandler.go b/api/internal/handler/adapters/getadapterrelationhandler.go index 1f265676..13212c35 100644 --- a/api/internal/handler/adapters/getadapterrelationhandler.go +++ b/api/internal/handler/adapters/getadapterrelationhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "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/repository/result" - "net/http" ) func GetAdapterRelationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AdapterRelationQueryReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewGetAdapterRelationLogic(r.Context(), svcCtx) resp, err := l.GetAdapterRelation(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/getclusterhandler.go b/api/internal/handler/adapters/getclusterhandler.go index 7fe828e9..865e861f 100644 --- a/api/internal/handler/adapters/getclusterhandler.go +++ b/api/internal/handler/adapters/getclusterhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "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/repository/result" - "net/http" ) func GetClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.FId if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewGetClusterLogic(r.Context(), svcCtx) resp, err := l.GetCluster(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/getclustersumhandler.go b/api/internal/handler/adapters/getclustersumhandler.go index bcd6d6af..18fd747e 100644 --- a/api/internal/handler/adapters/getclustersumhandler.go +++ b/api/internal/handler/adapters/getclustersumhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "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/repository/result" - "net/http" ) func GetClusterSumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ClusterSumReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewGetClusterSumLogic(r.Context(), svcCtx) resp, err := l.GetClusterSum(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/updateadapterhandler.go b/api/internal/handler/adapters/updateadapterhandler.go index 2f9ee8fa..3800fc16 100644 --- a/api/internal/handler/adapters/updateadapterhandler.go +++ b/api/internal/handler/adapters/updateadapterhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "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/repository/result" - "net/http" ) func UpdateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AdapterReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewUpdateAdapterLogic(r.Context(), svcCtx) resp, err := l.UpdateAdapter(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/updateclusterhandler.go b/api/internal/handler/adapters/updateclusterhandler.go index 197d0198..f5405d64 100644 --- a/api/internal/handler/adapters/updateclusterhandler.go +++ b/api/internal/handler/adapters/updateclusterhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "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/repository/result" - "net/http" ) func UpdateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ClusterCreateReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewUpdateClusterLogic(r.Context(), svcCtx) resp, err := l.UpdateCluster(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/core/centerresourceshandler.go b/api/internal/handler/core/centerresourceshandler.go index c8ff2014..6c7ae71e 100644 --- a/api/internal/handler/core/centerresourceshandler.go +++ b/api/internal/handler/core/centerresourceshandler.go @@ -1,9 +1,9 @@ package core import ( - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" ) @@ -12,6 +12,10 @@ func CenterResourcesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := core.NewCenterResourcesLogic(r.Context(), svcCtx) resp, err := l.CenterResources() - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/core/committaskhandler.go b/api/internal/handler/core/committaskhandler.go index 1930c2d0..3bea0b93 100644 --- a/api/internal/handler/core/committaskhandler.go +++ b/api/internal/handler/core/committaskhandler.go @@ -1,7 +1,6 @@ package core import ( - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" "net/http" "github.com/zeromicro/go-zero/rest/httpx" @@ -20,6 +19,10 @@ func CommitTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { l := core.NewCommitTaskLogic(r.Context(), svcCtx) err := l.CommitTask(&req) - result.HttpResult(r, w, nil, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } } } diff --git a/api/internal/handler/core/commitvmtaskhandler.go b/api/internal/handler/core/commitvmtaskhandler.go index 7f8ab825..f2ca9e4b 100644 --- a/api/internal/handler/core/commitvmtaskhandler.go +++ b/api/internal/handler/core/commitvmtaskhandler.go @@ -1,24 +1,28 @@ package core import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "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/repository/result" - "net/http" ) func CommitVmTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CommitVmTaskReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := core.NewCommitVmTaskLogic(r.Context(), svcCtx) resp, err := l.CommitVmTask(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/core/deletetaskhandler.go b/api/internal/handler/core/deletetaskhandler.go index 08430798..e5a735e0 100644 --- a/api/internal/handler/core/deletetaskhandler.go +++ b/api/internal/handler/core/deletetaskhandler.go @@ -1,21 +1,6 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" "net/http" "github.com/zeromicro/go-zero/rest/httpx" @@ -34,6 +19,10 @@ func DeleteTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { l := core.NewDeleteTaskLogic(r.Context(), svcCtx) err := l.DeleteTask(&req) - result.HttpResult(r, w, nil, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } } } diff --git a/api/internal/handler/core/getcomputilitystatisticshandler.go b/api/internal/handler/core/getcomputilitystatisticshandler.go index 51d91b8e..8a03ba36 100644 --- a/api/internal/handler/core/getcomputilitystatisticshandler.go +++ b/api/internal/handler/core/getcomputilitystatisticshandler.go @@ -1,17 +1,3 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( diff --git a/api/internal/handler/core/getcomputingpowerhandler.go b/api/internal/handler/core/getcomputingpowerhandler.go index 09ea3475..9e4c77ed 100644 --- a/api/internal/handler/core/getcomputingpowerhandler.go +++ b/api/internal/handler/core/getcomputingpowerhandler.go @@ -1,17 +1,3 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( diff --git a/api/internal/handler/core/getgeneralinfohandler.go b/api/internal/handler/core/getgeneralinfohandler.go index 87febd89..de4dc89f 100644 --- a/api/internal/handler/core/getgeneralinfohandler.go +++ b/api/internal/handler/core/getgeneralinfohandler.go @@ -1,17 +1,3 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( diff --git a/api/internal/handler/core/getregionhandler.go b/api/internal/handler/core/getregionhandler.go index 5e639d9f..f85e16c7 100644 --- a/api/internal/handler/core/getregionhandler.go +++ b/api/internal/handler/core/getregionhandler.go @@ -1,17 +1,3 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( diff --git a/api/internal/handler/core/getresourcepanelconfighandler.go b/api/internal/handler/core/getresourcepanelconfighandler.go index 36942c2f..45dde0c1 100644 --- a/api/internal/handler/core/getresourcepanelconfighandler.go +++ b/api/internal/handler/core/getresourcepanelconfighandler.go @@ -1,24 +1,9 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( "net/http" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" ) @@ -27,6 +12,10 @@ func GetResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc return func(w http.ResponseWriter, r *http.Request) { l := core.NewGetResourcePanelConfigLogic(r.Context(), svcCtx) resp, err := l.GetResourcePanelConfig() - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/core/jobtotalhandler.go b/api/internal/handler/core/jobtotalhandler.go index 8e31d97b..91caa200 100644 --- a/api/internal/handler/core/jobtotalhandler.go +++ b/api/internal/handler/core/jobtotalhandler.go @@ -1,23 +1,9 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" ) @@ -26,6 +12,10 @@ func JobTotalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := core.NewJobTotalLogic(r.Context(), svcCtx) resp, err := l.JobTotal() - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/core/listcenterhandler.go b/api/internal/handler/core/listcenterhandler.go index c9697a8b..cf988c03 100644 --- a/api/internal/handler/core/listcenterhandler.go +++ b/api/internal/handler/core/listcenterhandler.go @@ -1,17 +1,3 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( diff --git a/api/internal/handler/core/listclusterhandler.go b/api/internal/handler/core/listclusterhandler.go index a4a923ab..a2077a06 100644 --- a/api/internal/handler/core/listclusterhandler.go +++ b/api/internal/handler/core/listclusterhandler.go @@ -1,17 +1,3 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( diff --git a/api/internal/handler/core/listdomainresourcehandler.go b/api/internal/handler/core/listdomainresourcehandler.go index 1a7f819a..911beacf 100644 --- a/api/internal/handler/core/listdomainresourcehandler.go +++ b/api/internal/handler/core/listdomainresourcehandler.go @@ -1,24 +1,9 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( "net/http" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" ) @@ -27,6 +12,10 @@ func ListDomainResourceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := core.NewListDomainResourceLogic(r.Context(), svcCtx) resp, err := l.ListDomainResource() - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/core/listregionhandler.go b/api/internal/handler/core/listregionhandler.go index cfb1b1ab..c05760a6 100644 --- a/api/internal/handler/core/listregionhandler.go +++ b/api/internal/handler/core/listregionhandler.go @@ -1,17 +1,3 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( diff --git a/api/internal/handler/core/metricshandler.go b/api/internal/handler/core/metricshandler.go index fb157525..5f715b1d 100644 --- a/api/internal/handler/core/metricshandler.go +++ b/api/internal/handler/core/metricshandler.go @@ -1,12 +1,21 @@ package core import ( - "github.com/prometheus/client_golang/prometheus/promhttp" "net/http" + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" ) func MetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return promhttp.Handler().ServeHTTP + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewMetricsLogic(r.Context(), svcCtx) + err := l.Metrics() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } } diff --git a/api/internal/handler/core/nodeassetshandler.go b/api/internal/handler/core/nodeassetshandler.go index 21b4afde..f8bd04a4 100644 --- a/api/internal/handler/core/nodeassetshandler.go +++ b/api/internal/handler/core/nodeassetshandler.go @@ -1,23 +1,9 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" ) @@ -26,6 +12,10 @@ func NodeAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := core.NewNodeAssetsLogic(r.Context(), svcCtx) resp, err := l.NodeAssets() - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/core/participantlisthandler.go b/api/internal/handler/core/participantlisthandler.go index 2a306381..1f122e0f 100644 --- a/api/internal/handler/core/participantlisthandler.go +++ b/api/internal/handler/core/participantlisthandler.go @@ -1,23 +1,9 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" ) @@ -26,6 +12,10 @@ func ParticipantListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := core.NewParticipantListLogic(r.Context(), svcCtx) resp, err := l.ParticipantList() - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/core/pulltaskinfohandler.go b/api/internal/handler/core/pulltaskinfohandler.go index e1777968..87e8cccc 100644 --- a/api/internal/handler/core/pulltaskinfohandler.go +++ b/api/internal/handler/core/pulltaskinfohandler.go @@ -1,17 +1,17 @@ package core import ( - clientCore "gitlink.org.cn/JointCloud/pcm-coordinator/api/client" "net/http" "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" ) func PullTaskInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - var req clientCore.PullTaskInfoReq + var req types.PullTaskInfoReq if err := httpx.Parse(r, &req); err != nil { httpx.ErrorCtx(r.Context(), w, err) return diff --git a/api/internal/handler/core/pushtaskinfohandler.go b/api/internal/handler/core/pushtaskinfohandler.go index fa7f5e91..68c4637d 100644 --- a/api/internal/handler/core/pushtaskinfohandler.go +++ b/api/internal/handler/core/pushtaskinfohandler.go @@ -1,17 +1,17 @@ package core import ( - clientCore "gitlink.org.cn/JointCloud/pcm-coordinator/api/client" "net/http" "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" ) func PushTaskInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - var req clientCore.PushTaskInfoReq + var req types.PushTaskInfoReq if err := httpx.Parse(r, &req); err != nil { httpx.ErrorCtx(r.Context(), w, err) return diff --git a/api/internal/handler/core/putresourcepanelconfighandler.go b/api/internal/handler/core/putresourcepanelconfighandler.go index 8b45e55a..a425f19a 100644 --- a/api/internal/handler/core/putresourcepanelconfighandler.go +++ b/api/internal/handler/core/putresourcepanelconfighandler.go @@ -1,24 +1,8 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( "net/http" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" @@ -29,12 +13,16 @@ func PutResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc return func(w http.ResponseWriter, r *http.Request) { var req types.ResourcePanelConfigReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := core.NewPutResourcePanelConfigLogic(r.Context(), svcCtx) err := l.PutResourcePanelConfig(&req) - result.HttpResult(r, w, nil, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } } } diff --git a/api/internal/handler/core/scheduletaskbyyamlhandler.go b/api/internal/handler/core/scheduletaskbyyamlhandler.go index e597ad66..1841a389 100644 --- a/api/internal/handler/core/scheduletaskbyyamlhandler.go +++ b/api/internal/handler/core/scheduletaskbyyamlhandler.go @@ -1,22 +1,6 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils" "net/http" "github.com/zeromicro/go-zero/rest/httpx" @@ -29,22 +13,16 @@ func ScheduleTaskByYamlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ScheduleTaskByYamlReq if err := httpx.Parse(r, &req); err != nil { - result.HttpResult(r, w, nil, err) - return - } - // 解析yaml文件 - _, fileHeader, err := r.FormFile("file") - if err != nil { - result.HttpResult(r, w, nil, err) - return - } - err = utils.Yaml2struct(fileHeader, &req) - if err != nil { - result.HttpResult(r, w, nil, err) + httpx.ErrorCtx(r.Context(), w, err) return } + l := core.NewScheduleTaskByYamlLogic(r.Context(), svcCtx) - resp, err := l.ScheduleTaskByYaml(&req) - result.HttpResult(r, w, resp, err) + err := l.ScheduleTaskByYaml(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } } } diff --git a/api/internal/handler/core/syncclusterloadhandler.go b/api/internal/handler/core/syncclusterloadhandler.go index cd8de3a3..ff36e15b 100644 --- a/api/internal/handler/core/syncclusterloadhandler.go +++ b/api/internal/handler/core/syncclusterloadhandler.go @@ -1,7 +1,6 @@ package core import ( - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" "net/http" "github.com/zeromicro/go-zero/rest/httpx" @@ -20,6 +19,10 @@ func SyncClusterLoadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { l := core.NewSyncClusterLoadLogic(r.Context(), svcCtx) err := l.SyncClusterLoad(&req) - result.HttpResult(r, w, nil, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } } } diff --git a/api/internal/handler/core/taskdetailhandler.go b/api/internal/handler/core/taskdetailhandler.go index f4325530..e97f2706 100644 --- a/api/internal/handler/core/taskdetailhandler.go +++ b/api/internal/handler/core/taskdetailhandler.go @@ -1,21 +1,6 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" "net/http" "github.com/zeromicro/go-zero/rest/httpx" @@ -34,6 +19,10 @@ func TaskDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { l := core.NewTaskDetailLogic(r.Context(), svcCtx) resp, err := l.TaskDetail(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/core/tasklisthandler.go b/api/internal/handler/core/tasklisthandler.go index 18a7ad80..7b239009 100644 --- a/api/internal/handler/core/tasklisthandler.go +++ b/api/internal/handler/core/tasklisthandler.go @@ -1,17 +1,3 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( diff --git a/api/internal/handler/dictionary/adddicthandler.go b/api/internal/handler/dictionary/adddicthandler.go index f97da1bb..9abc0f7a 100644 --- a/api/internal/handler/dictionary/adddicthandler.go +++ b/api/internal/handler/dictionary/adddicthandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "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/repository/result" - "net/http" ) func AddDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictEditReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewAddDictLogic(r.Context(), svcCtx) resp, err := l.AddDict(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/adddictitemhandler.go b/api/internal/handler/dictionary/adddictitemhandler.go index 44dbe883..c1ab2c69 100644 --- a/api/internal/handler/dictionary/adddictitemhandler.go +++ b/api/internal/handler/dictionary/adddictitemhandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "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/repository/result" - "net/http" ) func AddDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictItemEditReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewAddDictItemLogic(r.Context(), svcCtx) resp, err := l.AddDictItem(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/deletedicthandler.go b/api/internal/handler/dictionary/deletedicthandler.go index e65e54c2..435f529e 100644 --- a/api/internal/handler/dictionary/deletedicthandler.go +++ b/api/internal/handler/dictionary/deletedicthandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "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/repository/result" - "net/http" ) func DeleteDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CId if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewDeleteDictLogic(r.Context(), svcCtx) resp, err := l.DeleteDict(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/deletedictitemhandler.go b/api/internal/handler/dictionary/deletedictitemhandler.go index 65139c09..e029202f 100644 --- a/api/internal/handler/dictionary/deletedictitemhandler.go +++ b/api/internal/handler/dictionary/deletedictitemhandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "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/repository/result" - "net/http" ) func DeleteDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CId if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewDeleteDictItemLogic(r.Context(), svcCtx) resp, err := l.DeleteDictItem(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/editdicthandler.go b/api/internal/handler/dictionary/editdicthandler.go index fe0ef391..b63e41be 100644 --- a/api/internal/handler/dictionary/editdicthandler.go +++ b/api/internal/handler/dictionary/editdicthandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "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/repository/result" - "net/http" ) func EditDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictEditReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewEditDictLogic(r.Context(), svcCtx) resp, err := l.EditDict(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/editdictitemhandler.go b/api/internal/handler/dictionary/editdictitemhandler.go index 295e9095..f4f2fd6c 100644 --- a/api/internal/handler/dictionary/editdictitemhandler.go +++ b/api/internal/handler/dictionary/editdictitemhandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "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/repository/result" - "net/http" ) func EditDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictItemEditReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewEditDictItemLogic(r.Context(), svcCtx) resp, err := l.EditDictItem(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/getdicthandler.go b/api/internal/handler/dictionary/getdicthandler.go index b1b56d0d..4a958990 100644 --- a/api/internal/handler/dictionary/getdicthandler.go +++ b/api/internal/handler/dictionary/getdicthandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "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/repository/result" - "net/http" ) func GetDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CId if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewGetDictLogic(r.Context(), svcCtx) resp, err := l.GetDict(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/getdictitemhandler.go b/api/internal/handler/dictionary/getdictitemhandler.go index bbfe113f..60d8ce06 100644 --- a/api/internal/handler/dictionary/getdictitemhandler.go +++ b/api/internal/handler/dictionary/getdictitemhandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "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/repository/result" - "net/http" ) func GetDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CId if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewGetDictItemLogic(r.Context(), svcCtx) resp, err := l.GetDictItem(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/listdicthandler.go b/api/internal/handler/dictionary/listdicthandler.go index 72dac7c8..5c34a136 100644 --- a/api/internal/handler/dictionary/listdicthandler.go +++ b/api/internal/handler/dictionary/listdicthandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "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/repository/result" - "net/http" ) func ListDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewListDictLogic(r.Context(), svcCtx) resp, err := l.ListDict(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/listdictitembycodehandler.go b/api/internal/handler/dictionary/listdictitembycodehandler.go index c6400185..98c6feab 100644 --- a/api/internal/handler/dictionary/listdictitembycodehandler.go +++ b/api/internal/handler/dictionary/listdictitembycodehandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "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/repository/result" - "net/http" ) func ListDictItemByCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictCodeReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewListDictItemByCodeLogic(r.Context(), svcCtx) resp, err := l.ListDictItemByCode(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/listdictitemhandler.go b/api/internal/handler/dictionary/listdictitemhandler.go index 16df182d..5607ee04 100644 --- a/api/internal/handler/dictionary/listdictitemhandler.go +++ b/api/internal/handler/dictionary/listdictitemhandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "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/repository/result" - "net/http" ) func ListDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictItemReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewListDictItemLogic(r.Context(), svcCtx) resp, err := l.ListDictItem(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/types/types.go b/api/internal/types/types.go index 074e9a0b..ccc11455 100644 --- a/api/internal/types/types.go +++ b/api/internal/types/types.go @@ -855,7 +855,6 @@ type CommitHpcTaskReq struct { TenantId int64 `json:"tenantId,optional"` TaskId int64 `json:"taskId,optional"` AdapterId int64 `json:"adapterId,optional"` - ClusterType string `json:"clusterType,optional"` MatchLabels map[string]string `json:"matchLabels,optional"` CardCount int64 `json:"cardCount,optional"` WorkDir string `json:"workDir,optional"` //paratera:workingDir @@ -873,9 +872,7 @@ type CommitHpcTaskReq struct { } type CommitHpcTaskResp struct { - Code int32 `json:"code"` - Msg string `json:"msg"` - TaskId int64 `json:"taskId"` + TaskId int64 `json:"taskId"` } type ListJobReq struct { @@ -2884,9 +2881,11 @@ type CreateServerResp struct { type Server struct { Name string `json:"name,optional" copier:"Name"` FlavorRef string `json:"flavorRef,optional" copier:"FlavorRef"` + Description string `json:"description,optional" copier:"Description"` ImageRef string `json:"imageRef,optional" copier:"ImageRef"` Networks []CreNetwork `json:"networks,optional" copier:"Networks"` BlockDeviceMappingV2 []Block_device_mapping_v2 `json:"block_device_mapping_v2,optional" copier:"BlockDeviceMappingV2"` + MinCount string `json:"min_count,optional" copier:"MinCount"` } type CreNetwork struct { @@ -3255,7 +3254,7 @@ type Network struct { Ipv6AddressScope string `json:"ipv6_address_scope,optional" copier:"Ipv6AddressScope"` L2Adjacency bool `json:"l2_adjacency,optional" copier:"L2Adjacency"` Mtu int64 `json:"mtu,optional" copier:"Mtu"` - Name string `json:",optional" copier:"Name"` + Name string `json:"name,optional" copier:"Name"` PortSecurityEnabled bool `json:"port_security_enabled,optional" copier:"PortSecurityEnabled"` ProjectId string `json:"project_id,optional" copier:"ProjectId"` QosPolicyId string `json:"qos_policy_id,optional" copier:"QosPolicyId"` @@ -5171,3 +5170,119 @@ type AiDatasetsResp struct { type AiStrategyResp struct { Strategies []string `json:"strategies"` } + +type PullTaskInfoReq struct { + AdapterId int64 `form:"adapterId"` +} + +type PullTaskInfoResp struct { + HpcInfoList []*HpcInfo `json:"HpcInfoList,omitempty"` + CloudInfoList []*CloudInfo `json:"CloudInfoList,omitempty"` + AiInfoList []*AiInfo `json:"AiInfoList,omitempty"` + VmInfoList []*VmInfo `json:"VmInfoList,omitempty"` +} + +type HpcInfo struct { + Id int64 `json:"id"` // id + TaskId int64 `json:"task_id"` // 任务id + JobId string `json:"job_id"` // 作业id(在第三方系统中的作业id) + ClusterId int64 `json:"cluster_id"` // 执行任务的集群id + ClusterType string `json:"cluster_type"` // 执行任务的集群类型 + Name string `json:"name"` // 名称 + Status string `json:"status"` // 状态 + CmdScript string `json:"cmd_script"` + StartTime string `json:"start_time"` // 开始时间 + RunningTime int64 `json:"running_time"` // 运行时间 + DerivedEs string `json:"derived_es"` + Cluster string `json:"cluster"` + BlockId int64 `json:"block_id"` + AllocNodes int64 `json:"alloc_nodes"` + AllocCpu int64 `json:"alloc_cpu"` + CardCount int64 `json:"card_count"` // 卡数 + Version string `json:"version"` + Account string `json:"account"` + WorkDir string `json:"work_dir"` // 工作路径 + AssocId int64 `json:"assoc_id"` + ExitCode int64 `json:"exit_code"` + WallTime string `json:"wall_time"` // 最大运行时间 + Result string `json:"result"` // 运行结果 + DeletedAt string `json:"deleted_at"` // 删除时间 + YamlString string `json:"yaml_string"` + AppType string `json:"app_type"` // 应用类型 + AppName string `json:"app_name"` // 应用名称 + Queue string `json:"queue"` // 队列名称 + SubmitType string `json:"submit_type"` // cmd(命令行模式) + NNode string `json:"n_node"` // 节点个数(当指定该参数时,GAP_NODE_STRING必须为"") + StdOutFile string `json:"std_out_file"` // 工作路径/std.err.%j + StdErrFile string `json:"std_err_file"` // 工作路径/std.err.%j + StdInput string `json:"std_input"` + Environment string `json:"environment"` + DeletedFlag int64 `json:"deleted_flag"` // 是否删除(0-否,1-是) + CreatedBy int64 `json:"created_by"` // 创建人 + CreatedTime string `json:"created_time"` // 创建时间 + UpdatedBy int64 `json:"updated_by"` // 更新人 + UpdatedTime string `json:"updated_time"` // 更新时间 +} + +type CloudInfo struct { + Participant int64 `json:"participant,omitempty"` + Id int64 `json:"id,omitempty"` + TaskId int64 `json:"taskId,omitempty"` + ApiVersion string `json:"apiVersion,omitempty"` + Kind string `json:"kind,omitempty"` + Namespace string `json:"namespace,omitempty"` + Name string `json:"name,omitempty"` + Status string `json:"status,omitempty"` + StartTime string `json:"startTime,omitempty"` + RunningTime int64 `json:"runningTime,omitempty"` + Result string `json:"result,omitempty"` + YamlString string `json:"yamlString,omitempty"` +} + +type AiInfo struct { + ParticipantId int64 `json:"participantId,omitempty"` + TaskId int64 `json:"taskId,omitempty"` + ProjectId string `json:"project_id,omitempty"` + Name string `json:"name,omitempty"` + Status string `json:"status,omitempty"` + StartTime string `json:"startTime,omitempty"` + RunningTime int64 `json:"runningTime,omitempty"` + Result string `json:"result,omitempty"` + JobId string `json:"jobId,omitempty"` + CreateTime string `json:"createTime,omitempty"` + ImageUrl string `json:"imageUrl,omitempty"` + Command string `json:"command,omitempty"` + FlavorId string `json:"flavorId,omitempty"` + SubscriptionId string `json:"subscriptionId,omitempty"` + ItemVersionId string `json:"itemVersionId,omitempty"` +} + +type VmInfo struct { + ParticipantId int64 `json:"participantId,omitempty"` + TaskId int64 `json:"taskId,omitempty"` + Name string `json:"name,omitempty"` + FlavorRef string `json:"flavor_ref,omitempty"` + ImageRef string `json:"image_ref,omitempty"` + NetworkUuid string `json:"network_uuid,omitempty"` + BlockUuid string `json:"block_uuid,omitempty"` + SourceType string `json:"source_type,omitempty"` + DeleteOnTermination bool `json:"delete_on_termination,omitempty"` + State string `json:"state,omitempty"` +} + +type PushTaskInfoReq struct { + AdapterId int64 `json:"adapterId"` + HpcInfoList []*HpcInfo `json:"hpcInfoList"` + CloudInfoList []*CloudInfo `json:"cloudInfoList"` + AiInfoList []*AiInfo `json:"aiInfoList"` + VmInfoList []*VmInfo `json:"vmInfoList"` +} + +type PushTaskInfoResp struct { + Code int64 `json:"code"` + Msg string `json:"msg"` +} + +type PushResourceInfoReq struct { + AdapterId int64 `json:"adapterId"` +} From f3277b72d8a1533041656042385e1f85c9c4a90d Mon Sep 17 00:00:00 2001 From: qiwang <1364512070@qq.com> Date: Mon, 25 Mar 2024 19:37:55 +0800 Subject: [PATCH 2/4] fix:Modify configuration file fields Former-commit-id: 3fa5bd31a09c993bc89ccafcc7850fd5f477f06a --- api/desc/core/pcm-core.api | 1 - api/desc/hpc/pcm-hpc.api | 3 + .../handler/adapters/adapterslisthandler.go | 28 - .../handler/adapters/clusterlisthandler.go | 28 - .../handler/adapters/createadapterhandler.go | 28 - .../handler/adapters/createclusterhandler.go | 28 - .../handler/adapters/deleteadapterhandler.go | 28 - .../handler/adapters/deleteclusterhandler.go | 28 - .../handler/adapters/getadapterhandler.go | 28 - .../adapters/getadapterrelationhandler.go | 28 - .../handler/adapters/getclusterhandler.go | 28 - .../handler/adapters/getclustersumhandler.go | 28 - .../handler/adapters/updateadapterhandler.go | 28 - .../handler/adapters/updateclusterhandler.go | 28 - .../handler/ai/createalgorithmhandler.go | 28 - .../handler/ai/createdatasethandler.go | 28 - .../handler/ai/createexporttaskhandler.go | 28 - .../handler/ai/createnotebookhandler.go | 28 - .../handler/ai/createprocessortaskhandler.go | 28 - .../handler/ai/createservicehandler.go | 28 - api/internal/handler/ai/createtaskhandler.go | 28 - .../handler/ai/createtrainingjobhandler.go | 28 - .../ai/createvisualizationjobhandler.go | 28 - .../handler/ai/deletealgorithmhandler.go | 28 - .../handler/ai/deletedatasethandler.go | 28 - .../handler/ai/deleteservicehandler.go | 28 - .../handler/ai/deletetrainingjobhandler.go | 28 - .../ai/getexporttasksofdatasethandler.go | 28 - .../ai/getexporttaskstatusofdatasethandler.go | 28 - .../handler/ai/getlisttrainingjobshandler.go | 28 - .../handler/ai/getnotebookstoragehandler.go | 28 - .../handler/ai/getvisualizationjobhandler.go | 28 - .../handler/ai/listalgorithmshandler.go | 28 - .../handler/ai/listclustershandler.go | 28 - api/internal/handler/ai/listdatasethandler.go | 28 - api/internal/handler/ai/listimporthandler.go | 28 - .../handler/ai/listnotebookhandler.go | 28 - .../handler/ai/listserviceshandler.go | 28 - .../handler/ai/mountnotebookstoragehandler.go | 28 - .../handler/ai/showalgorithmbyuuidhandler.go | 28 - api/internal/handler/ai/showservicehandler.go | 28 - .../handler/ai/startnotebookhandler.go | 28 - .../handler/ai/stopnotebookhandler.go | 28 - api/internal/handler/apps/appdetailhandler.go | 28 - api/internal/handler/apps/applisthandler.go | 28 - api/internal/handler/apps/apppodshandler.go | 28 - .../handler/apps/deleteappbyappnamehandler.go | 28 - .../handler/apps/getappbyappnamehandler.go | 28 - .../handler/apps/pauseappbyappnamehandler.go | 28 - .../apps/restartappbyappnamehandler.go | 28 - .../handler/apps/startappbyappnamehandler.go | 28 - .../handler/apps/updateappbyappnamehandler.go | 28 - .../handler/cloud/cloudlisthandler.go | 21 - .../handler/cloud/controllermetricshandler.go | 28 - .../handler/cloud/deleteclusterhandler.go | 28 - .../handler/cloud/deleteyamlhandler.go | 28 - .../handler/cloud/getclusterlisthandler.go | 28 - .../handler/cloud/noticetenanthandler.go | 21 - .../handler/cloud/registerclusterhandler.go | 28 - .../handler/cloud/updatetenanthandler.go | 28 - .../handler/core/centerresourceshandler.go | 21 - .../handler/core/committaskhandler.go | 28 - .../handler/core/commitvmtaskhandler.go | 28 - .../handler/core/deletetaskhandler.go | 28 - .../core/getcomputilitystatisticshandler.go | 21 - .../handler/core/getcomputingpowerhandler.go | 21 - .../handler/core/getgeneralinfohandler.go | 21 - api/internal/handler/core/getregionhandler.go | 21 - .../core/getresourcepanelconfighandler.go | 21 - api/internal/handler/core/jobtotalhandler.go | 21 - .../handler/core/listcenterhandler.go | 21 - .../handler/core/listclusterhandler.go | 28 - .../handler/core/listdomainresourcehandler.go | 21 - .../handler/core/listregionhandler.go | 21 - api/internal/handler/core/metricshandler.go | 21 - .../handler/core/nodeassetshandler.go | 21 - .../handler/core/participantlisthandler.go | 21 - .../handler/core/pulltaskinfohandler.go | 28 - .../handler/core/pushtaskinfohandler.go | 28 - .../core/putresourcepanelconfighandler.go | 28 - .../handler/core/scheduletaskbyyamlhandler.go | 28 - .../handler/core/syncclusterloadhandler.go | 28 - .../handler/core/taskdetailhandler.go | 28 - api/internal/handler/core/tasklisthandler.go | 28 - .../handler/dictionary/adddicthandler.go | 28 - .../handler/dictionary/adddictitemhandler.go | 28 - .../handler/dictionary/deletedicthandler.go | 28 - .../dictionary/deletedictitemhandler.go | 28 - .../handler/dictionary/editdicthandler.go | 28 - .../handler/dictionary/editdictitemhandler.go | 28 - .../handler/dictionary/getdicthandler.go | 28 - .../handler/dictionary/getdictitemhandler.go | 28 - .../handler/dictionary/listdicthandler.go | 28 - .../dictionary/listdictitembycodehandler.go | 28 - .../handler/dictionary/listdictitemhandler.go | 28 - .../handler/hpc/commithpctaskhandler.go | 28 - .../handler/hpc/listhistoryjobhandler.go | 28 - api/internal/handler/hpc/listjobhandler.go | 28 - .../handler/hpc/queueassetshandler.go | 21 - api/internal/handler/image/chunkhandler.go | 21 - .../handler/image/datasetcheckhandler.go | 28 - .../handler/image/imagelisthandler.go | 21 - .../handler/image/uploaddatasethandler.go | 21 - api/internal/handler/image/uploadhandler.go | 21 - api/internal/handler/routes.go | 1166 ----------------- .../schedulegetairesourcetypeshandler.go | 21 - .../schedule/schedulegetaitasktypeshandler.go | 21 - .../schedule/schedulegetdatasetshandler.go | 21 - .../schedule/schedulegetstrategyhandler.go | 21 - .../handler/schedule/schedulesubmithandler.go | 28 - .../storage/dailypowerscreenhandler.go | 28 - .../storage/percentercomputerpowershandler.go | 28 - .../handler/storage/screenstoragehandler.go | 28 - .../storelink/deletelinkimagehandler.go | 28 - .../storelink/deletelinktaskhandler.go | 28 - .../handler/storelink/getaispecshandler.go | 28 - .../storelink/getlinkimagelisthandler.go | 28 - .../handler/storelink/getlinktaskhandler.go | 28 - .../storelink/getparticipantshandler.go | 28 - .../storelink/submitlinktaskhandler.go | 28 - .../storelink/uploadlinkimagehandler.go | 28 - .../vm/addsecuritygrouptoserverhandler.go | 28 - .../handler/vm/bulkcreatenetworkshandler.go | 28 - .../vm/changeadministrativepasswordhandler.go | 28 - .../handler/vm/createfirewallgrouphandler.go | 28 - .../handler/vm/createfirewallpolicyhandler.go | 28 - .../handler/vm/createfirewallrulehandler.go | 28 - .../handler/vm/createflavorhandler.go | 28 - .../handler/vm/createfloatingiphandler.go | 28 - api/internal/handler/vm/createimagehandler.go | 28 - .../handler/vm/createnetworkhandler.go | 28 - .../vm/createnetworksegmentrangehandler.go | 28 - api/internal/handler/vm/createnodehandler.go | 28 - api/internal/handler/vm/createporthandler.go | 28 - .../handler/vm/createrouterhandler.go | 28 - .../handler/vm/createsecuritygrouphandler.go | 28 - .../vm/createsecuritygrouprulehandler.go | 28 - .../handler/vm/createserverhandler.go | 28 - .../handler/vm/createsubnethandler.go | 28 - .../handler/vm/createvolumehandler.go | 28 - .../handler/vm/createvolumetypeshandler.go | 28 - .../handler/vm/deletefirewallgrouphandler.go | 28 - .../handler/vm/deletefirewallpolicyhandler.go | 28 - .../handler/vm/deletefirewallrulehandler.go | 28 - .../handler/vm/deleteflavorhandler.go | 28 - .../handler/vm/deletefloatingiphandler.go | 28 - api/internal/handler/vm/deleteimagehandler.go | 28 - .../handler/vm/deletenetworkhandler.go | 28 - .../vm/deletenetworksegmentrangeshandler.go | 28 - api/internal/handler/vm/deletenodehandler.go | 28 - api/internal/handler/vm/deleteporthandler.go | 28 - .../handler/vm/deleterouterhandler.go | 28 - .../handler/vm/deletesecuritygrouphandler.go | 28 - .../vm/deletesecuritygrouprulehandler.go | 28 - .../handler/vm/deleteserverhandler.go | 28 - .../handler/vm/deletesubnethandler.go | 28 - .../handler/vm/deletevolumehandler.go | 28 - .../handler/vm/deletevolumetypehandler.go | 28 - .../handler/vm/getcomputelimitshandler.go | 28 - api/internal/handler/vm/getimagenumhandler.go | 28 - .../handler/vm/getnetworknumhandler.go | 28 - .../vm/getserversdetailedbyidhandler.go | 28 - .../vm/getvolumedetailedbyidhandler.go | 28 - .../handler/vm/getvolumelimitshandler.go | 28 - .../handler/vm/listfirewallgroupshandler.go | 28 - .../handler/vm/listfirewallpolicieshandler.go | 28 - .../handler/vm/listfirewallruleshandler.go | 28 - .../handler/vm/listflavorsdetailhandler.go | 28 - .../handler/vm/listfloatingipshandler.go | 28 - api/internal/handler/vm/listimageshandler.go | 28 - .../listnetworksegmentrangesrangehandler.go | 28 - .../handler/vm/listnetworkshandler.go | 28 - api/internal/handler/vm/listnodeshandler.go | 28 - api/internal/handler/vm/listportshandler.go | 28 - api/internal/handler/vm/listroutershandler.go | 28 - .../vm/listsecuritygroupruleshandler.go | 28 - .../handler/vm/listsecuritygroupshandler.go | 28 - api/internal/handler/vm/listserverhandler.go | 28 - .../handler/vm/listserversdetailedhandler.go | 28 - api/internal/handler/vm/listsubnetshandler.go | 28 - .../handler/vm/listvolumesdetailhandler.go | 28 - api/internal/handler/vm/listvolumeshandler.go | 28 - .../handler/vm/listvolumetypeshandler.go | 28 - .../handler/vm/migrateserverhandler.go | 28 - api/internal/handler/vm/pauseserverhandler.go | 28 - .../handler/vm/rebootserverhandler.go | 28 - .../handler/vm/removesecuritygrouphandler.go | 28 - .../handler/vm/rescueserverhandler.go | 28 - .../handler/vm/resizeserverhandler.go | 28 - .../handler/vm/shelveserverhandler.go | 28 - .../vm/showfirewallgroupdetailshandler.go | 28 - .../vm/showfirewallpolicydetailshandler.go | 28 - .../vm/showfirewallruledetailshandler.go | 28 - .../vm/showfloatingipdetailshandler.go | 28 - .../handler/vm/shownetworkdetailshandler.go | 28 - .../shownetworksegmentrangedetailshandler.go | 28 - .../handler/vm/shownodedetailshandler.go | 28 - .../handler/vm/showportdetailshandler.go | 28 - .../handler/vm/showrouterdetailshandler.go | 28 - .../handler/vm/showsecuritygrouphandler.go | 28 - .../vm/showsecuritygrouprulehandler.go | 28 - api/internal/handler/vm/startserverhandler.go | 28 - api/internal/handler/vm/stopserverhandler.go | 28 - .../handler/vm/suspendserverhandler.go | 28 - .../handler/vm/unpauseserverhandler.go | 28 - api/internal/handler/vm/unrescuehandler.go | 28 - .../handler/vm/updatefirewallgrouphandler.go | 28 - .../handler/vm/updatefloatingiphandler.go | 28 - .../handler/vm/updatenetworkhandler.go | 28 - .../vm/updatenetworksegmentrangeshandler.go | 28 - api/internal/handler/vm/updateporthandler.go | 28 - .../handler/vm/updaterouterhandler.go | 28 - .../handler/vm/updatesecuritygrouphandler.go | 28 - .../handler/vm/updateserverhandler.go | 28 - .../handler/vm/updatesubnethandler.go | 28 - .../handler/vm/updatevolumehandler.go | 28 - api/internal/handler/vm/uploadimagehandler.go | 28 - api/internal/types/types.go | 7 +- 218 files changed, 8 insertions(+), 6993 deletions(-) delete mode 100644 api/internal/handler/adapters/adapterslisthandler.go delete mode 100644 api/internal/handler/adapters/clusterlisthandler.go delete mode 100644 api/internal/handler/adapters/createadapterhandler.go delete mode 100644 api/internal/handler/adapters/createclusterhandler.go delete mode 100644 api/internal/handler/adapters/deleteadapterhandler.go delete mode 100644 api/internal/handler/adapters/deleteclusterhandler.go delete mode 100644 api/internal/handler/adapters/getadapterhandler.go delete mode 100644 api/internal/handler/adapters/getadapterrelationhandler.go delete mode 100644 api/internal/handler/adapters/getclusterhandler.go delete mode 100644 api/internal/handler/adapters/getclustersumhandler.go delete mode 100644 api/internal/handler/adapters/updateadapterhandler.go delete mode 100644 api/internal/handler/adapters/updateclusterhandler.go delete mode 100644 api/internal/handler/ai/createalgorithmhandler.go delete mode 100644 api/internal/handler/ai/createdatasethandler.go delete mode 100644 api/internal/handler/ai/createexporttaskhandler.go delete mode 100644 api/internal/handler/ai/createnotebookhandler.go delete mode 100644 api/internal/handler/ai/createprocessortaskhandler.go delete mode 100644 api/internal/handler/ai/createservicehandler.go delete mode 100644 api/internal/handler/ai/createtaskhandler.go delete mode 100644 api/internal/handler/ai/createtrainingjobhandler.go delete mode 100644 api/internal/handler/ai/createvisualizationjobhandler.go delete mode 100644 api/internal/handler/ai/deletealgorithmhandler.go delete mode 100644 api/internal/handler/ai/deletedatasethandler.go delete mode 100644 api/internal/handler/ai/deleteservicehandler.go delete mode 100644 api/internal/handler/ai/deletetrainingjobhandler.go delete mode 100644 api/internal/handler/ai/getexporttasksofdatasethandler.go delete mode 100644 api/internal/handler/ai/getexporttaskstatusofdatasethandler.go delete mode 100644 api/internal/handler/ai/getlisttrainingjobshandler.go delete mode 100644 api/internal/handler/ai/getnotebookstoragehandler.go delete mode 100644 api/internal/handler/ai/getvisualizationjobhandler.go delete mode 100644 api/internal/handler/ai/listalgorithmshandler.go delete mode 100644 api/internal/handler/ai/listclustershandler.go delete mode 100644 api/internal/handler/ai/listdatasethandler.go delete mode 100644 api/internal/handler/ai/listimporthandler.go delete mode 100644 api/internal/handler/ai/listnotebookhandler.go delete mode 100644 api/internal/handler/ai/listserviceshandler.go delete mode 100644 api/internal/handler/ai/mountnotebookstoragehandler.go delete mode 100644 api/internal/handler/ai/showalgorithmbyuuidhandler.go delete mode 100644 api/internal/handler/ai/showservicehandler.go delete mode 100644 api/internal/handler/ai/startnotebookhandler.go delete mode 100644 api/internal/handler/ai/stopnotebookhandler.go delete mode 100644 api/internal/handler/apps/appdetailhandler.go delete mode 100644 api/internal/handler/apps/applisthandler.go delete mode 100644 api/internal/handler/apps/apppodshandler.go delete mode 100644 api/internal/handler/apps/deleteappbyappnamehandler.go delete mode 100644 api/internal/handler/apps/getappbyappnamehandler.go delete mode 100644 api/internal/handler/apps/pauseappbyappnamehandler.go delete mode 100644 api/internal/handler/apps/restartappbyappnamehandler.go delete mode 100644 api/internal/handler/apps/startappbyappnamehandler.go delete mode 100644 api/internal/handler/apps/updateappbyappnamehandler.go delete mode 100644 api/internal/handler/cloud/cloudlisthandler.go delete mode 100644 api/internal/handler/cloud/controllermetricshandler.go delete mode 100644 api/internal/handler/cloud/deleteclusterhandler.go delete mode 100644 api/internal/handler/cloud/deleteyamlhandler.go delete mode 100644 api/internal/handler/cloud/getclusterlisthandler.go delete mode 100644 api/internal/handler/cloud/noticetenanthandler.go delete mode 100644 api/internal/handler/cloud/registerclusterhandler.go delete mode 100644 api/internal/handler/cloud/updatetenanthandler.go delete mode 100644 api/internal/handler/core/centerresourceshandler.go delete mode 100644 api/internal/handler/core/committaskhandler.go delete mode 100644 api/internal/handler/core/commitvmtaskhandler.go delete mode 100644 api/internal/handler/core/deletetaskhandler.go delete mode 100644 api/internal/handler/core/getcomputilitystatisticshandler.go delete mode 100644 api/internal/handler/core/getcomputingpowerhandler.go delete mode 100644 api/internal/handler/core/getgeneralinfohandler.go delete mode 100644 api/internal/handler/core/getregionhandler.go delete mode 100644 api/internal/handler/core/getresourcepanelconfighandler.go delete mode 100644 api/internal/handler/core/jobtotalhandler.go delete mode 100644 api/internal/handler/core/listcenterhandler.go delete mode 100644 api/internal/handler/core/listclusterhandler.go delete mode 100644 api/internal/handler/core/listdomainresourcehandler.go delete mode 100644 api/internal/handler/core/listregionhandler.go delete mode 100644 api/internal/handler/core/metricshandler.go delete mode 100644 api/internal/handler/core/nodeassetshandler.go delete mode 100644 api/internal/handler/core/participantlisthandler.go delete mode 100644 api/internal/handler/core/pulltaskinfohandler.go delete mode 100644 api/internal/handler/core/pushtaskinfohandler.go delete mode 100644 api/internal/handler/core/putresourcepanelconfighandler.go delete mode 100644 api/internal/handler/core/scheduletaskbyyamlhandler.go delete mode 100644 api/internal/handler/core/syncclusterloadhandler.go delete mode 100644 api/internal/handler/core/taskdetailhandler.go delete mode 100644 api/internal/handler/core/tasklisthandler.go delete mode 100644 api/internal/handler/dictionary/adddicthandler.go delete mode 100644 api/internal/handler/dictionary/adddictitemhandler.go delete mode 100644 api/internal/handler/dictionary/deletedicthandler.go delete mode 100644 api/internal/handler/dictionary/deletedictitemhandler.go delete mode 100644 api/internal/handler/dictionary/editdicthandler.go delete mode 100644 api/internal/handler/dictionary/editdictitemhandler.go delete mode 100644 api/internal/handler/dictionary/getdicthandler.go delete mode 100644 api/internal/handler/dictionary/getdictitemhandler.go delete mode 100644 api/internal/handler/dictionary/listdicthandler.go delete mode 100644 api/internal/handler/dictionary/listdictitembycodehandler.go delete mode 100644 api/internal/handler/dictionary/listdictitemhandler.go delete mode 100644 api/internal/handler/hpc/commithpctaskhandler.go delete mode 100644 api/internal/handler/hpc/listhistoryjobhandler.go delete mode 100644 api/internal/handler/hpc/listjobhandler.go delete mode 100644 api/internal/handler/hpc/queueassetshandler.go delete mode 100644 api/internal/handler/image/chunkhandler.go delete mode 100644 api/internal/handler/image/datasetcheckhandler.go delete mode 100644 api/internal/handler/image/imagelisthandler.go delete mode 100644 api/internal/handler/image/uploaddatasethandler.go delete mode 100644 api/internal/handler/image/uploadhandler.go delete mode 100644 api/internal/handler/routes.go delete mode 100644 api/internal/handler/schedule/schedulegetairesourcetypeshandler.go delete mode 100644 api/internal/handler/schedule/schedulegetaitasktypeshandler.go delete mode 100644 api/internal/handler/schedule/schedulegetdatasetshandler.go delete mode 100644 api/internal/handler/schedule/schedulegetstrategyhandler.go delete mode 100644 api/internal/handler/schedule/schedulesubmithandler.go delete mode 100644 api/internal/handler/storage/dailypowerscreenhandler.go delete mode 100644 api/internal/handler/storage/percentercomputerpowershandler.go delete mode 100644 api/internal/handler/storage/screenstoragehandler.go delete mode 100644 api/internal/handler/storelink/deletelinkimagehandler.go delete mode 100644 api/internal/handler/storelink/deletelinktaskhandler.go delete mode 100644 api/internal/handler/storelink/getaispecshandler.go delete mode 100644 api/internal/handler/storelink/getlinkimagelisthandler.go delete mode 100644 api/internal/handler/storelink/getlinktaskhandler.go delete mode 100644 api/internal/handler/storelink/getparticipantshandler.go delete mode 100644 api/internal/handler/storelink/submitlinktaskhandler.go delete mode 100644 api/internal/handler/storelink/uploadlinkimagehandler.go delete mode 100644 api/internal/handler/vm/addsecuritygrouptoserverhandler.go delete mode 100644 api/internal/handler/vm/bulkcreatenetworkshandler.go delete mode 100644 api/internal/handler/vm/changeadministrativepasswordhandler.go delete mode 100644 api/internal/handler/vm/createfirewallgrouphandler.go delete mode 100644 api/internal/handler/vm/createfirewallpolicyhandler.go delete mode 100644 api/internal/handler/vm/createfirewallrulehandler.go delete mode 100644 api/internal/handler/vm/createflavorhandler.go delete mode 100644 api/internal/handler/vm/createfloatingiphandler.go delete mode 100644 api/internal/handler/vm/createimagehandler.go delete mode 100644 api/internal/handler/vm/createnetworkhandler.go delete mode 100644 api/internal/handler/vm/createnetworksegmentrangehandler.go delete mode 100644 api/internal/handler/vm/createnodehandler.go delete mode 100644 api/internal/handler/vm/createporthandler.go delete mode 100644 api/internal/handler/vm/createrouterhandler.go delete mode 100644 api/internal/handler/vm/createsecuritygrouphandler.go delete mode 100644 api/internal/handler/vm/createsecuritygrouprulehandler.go delete mode 100644 api/internal/handler/vm/createserverhandler.go delete mode 100644 api/internal/handler/vm/createsubnethandler.go delete mode 100644 api/internal/handler/vm/createvolumehandler.go delete mode 100644 api/internal/handler/vm/createvolumetypeshandler.go delete mode 100644 api/internal/handler/vm/deletefirewallgrouphandler.go delete mode 100644 api/internal/handler/vm/deletefirewallpolicyhandler.go delete mode 100644 api/internal/handler/vm/deletefirewallrulehandler.go delete mode 100644 api/internal/handler/vm/deleteflavorhandler.go delete mode 100644 api/internal/handler/vm/deletefloatingiphandler.go delete mode 100644 api/internal/handler/vm/deleteimagehandler.go delete mode 100644 api/internal/handler/vm/deletenetworkhandler.go delete mode 100644 api/internal/handler/vm/deletenetworksegmentrangeshandler.go delete mode 100644 api/internal/handler/vm/deletenodehandler.go delete mode 100644 api/internal/handler/vm/deleteporthandler.go delete mode 100644 api/internal/handler/vm/deleterouterhandler.go delete mode 100644 api/internal/handler/vm/deletesecuritygrouphandler.go delete mode 100644 api/internal/handler/vm/deletesecuritygrouprulehandler.go delete mode 100644 api/internal/handler/vm/deleteserverhandler.go delete mode 100644 api/internal/handler/vm/deletesubnethandler.go delete mode 100644 api/internal/handler/vm/deletevolumehandler.go delete mode 100644 api/internal/handler/vm/deletevolumetypehandler.go delete mode 100644 api/internal/handler/vm/getcomputelimitshandler.go delete mode 100644 api/internal/handler/vm/getimagenumhandler.go delete mode 100644 api/internal/handler/vm/getnetworknumhandler.go delete mode 100644 api/internal/handler/vm/getserversdetailedbyidhandler.go delete mode 100644 api/internal/handler/vm/getvolumedetailedbyidhandler.go delete mode 100644 api/internal/handler/vm/getvolumelimitshandler.go delete mode 100644 api/internal/handler/vm/listfirewallgroupshandler.go delete mode 100644 api/internal/handler/vm/listfirewallpolicieshandler.go delete mode 100644 api/internal/handler/vm/listfirewallruleshandler.go delete mode 100644 api/internal/handler/vm/listflavorsdetailhandler.go delete mode 100644 api/internal/handler/vm/listfloatingipshandler.go delete mode 100644 api/internal/handler/vm/listimageshandler.go delete mode 100644 api/internal/handler/vm/listnetworksegmentrangesrangehandler.go delete mode 100644 api/internal/handler/vm/listnetworkshandler.go delete mode 100644 api/internal/handler/vm/listnodeshandler.go delete mode 100644 api/internal/handler/vm/listportshandler.go delete mode 100644 api/internal/handler/vm/listroutershandler.go delete mode 100644 api/internal/handler/vm/listsecuritygroupruleshandler.go delete mode 100644 api/internal/handler/vm/listsecuritygroupshandler.go delete mode 100644 api/internal/handler/vm/listserverhandler.go delete mode 100644 api/internal/handler/vm/listserversdetailedhandler.go delete mode 100644 api/internal/handler/vm/listsubnetshandler.go delete mode 100644 api/internal/handler/vm/listvolumesdetailhandler.go delete mode 100644 api/internal/handler/vm/listvolumeshandler.go delete mode 100644 api/internal/handler/vm/listvolumetypeshandler.go delete mode 100644 api/internal/handler/vm/migrateserverhandler.go delete mode 100644 api/internal/handler/vm/pauseserverhandler.go delete mode 100644 api/internal/handler/vm/rebootserverhandler.go delete mode 100644 api/internal/handler/vm/removesecuritygrouphandler.go delete mode 100644 api/internal/handler/vm/rescueserverhandler.go delete mode 100644 api/internal/handler/vm/resizeserverhandler.go delete mode 100644 api/internal/handler/vm/shelveserverhandler.go delete mode 100644 api/internal/handler/vm/showfirewallgroupdetailshandler.go delete mode 100644 api/internal/handler/vm/showfirewallpolicydetailshandler.go delete mode 100644 api/internal/handler/vm/showfirewallruledetailshandler.go delete mode 100644 api/internal/handler/vm/showfloatingipdetailshandler.go delete mode 100644 api/internal/handler/vm/shownetworkdetailshandler.go delete mode 100644 api/internal/handler/vm/shownetworksegmentrangedetailshandler.go delete mode 100644 api/internal/handler/vm/shownodedetailshandler.go delete mode 100644 api/internal/handler/vm/showportdetailshandler.go delete mode 100644 api/internal/handler/vm/showrouterdetailshandler.go delete mode 100644 api/internal/handler/vm/showsecuritygrouphandler.go delete mode 100644 api/internal/handler/vm/showsecuritygrouprulehandler.go delete mode 100644 api/internal/handler/vm/startserverhandler.go delete mode 100644 api/internal/handler/vm/stopserverhandler.go delete mode 100644 api/internal/handler/vm/suspendserverhandler.go delete mode 100644 api/internal/handler/vm/unpauseserverhandler.go delete mode 100644 api/internal/handler/vm/unrescuehandler.go delete mode 100644 api/internal/handler/vm/updatefirewallgrouphandler.go delete mode 100644 api/internal/handler/vm/updatefloatingiphandler.go delete mode 100644 api/internal/handler/vm/updatenetworkhandler.go delete mode 100644 api/internal/handler/vm/updatenetworksegmentrangeshandler.go delete mode 100644 api/internal/handler/vm/updateporthandler.go delete mode 100644 api/internal/handler/vm/updaterouterhandler.go delete mode 100644 api/internal/handler/vm/updatesecuritygrouphandler.go delete mode 100644 api/internal/handler/vm/updateserverhandler.go delete mode 100644 api/internal/handler/vm/updatesubnethandler.go delete mode 100644 api/internal/handler/vm/updatevolumehandler.go delete mode 100644 api/internal/handler/vm/uploadimagehandler.go diff --git a/api/desc/core/pcm-core.api b/api/desc/core/pcm-core.api index a61f1a35..56751a8e 100644 --- a/api/desc/core/pcm-core.api +++ b/api/desc/core/pcm-core.api @@ -109,7 +109,6 @@ type ( ) type ( - commitVmTaskReq { Name string `json:"name"` NsID string `json:"nsID"` diff --git a/api/desc/hpc/pcm-hpc.api b/api/desc/hpc/pcm-hpc.api index 23bb516c..2a971c4d 100644 --- a/api/desc/hpc/pcm-hpc.api +++ b/api/desc/hpc/pcm-hpc.api @@ -38,12 +38,15 @@ type ( StdErrFile string `json:"stdErrFile,optional"` StdInput string `json:"stdInput,optional"` Environment map[string]string `json:"environment,optional"` + ClusterType string `json:"clusterType,optional"` } ) type ( commitHpcTaskResp { TaskId int64 `json:"taskId"` + Code int32 `json:"code"` + Msg string `json:"msg"` } ) diff --git a/api/internal/handler/adapters/adapterslisthandler.go b/api/internal/handler/adapters/adapterslisthandler.go deleted file mode 100644 index 3d84c0c8..00000000 --- a/api/internal/handler/adapters/adapterslisthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func AdaptersListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AdapterQueryReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewAdaptersListLogic(r.Context(), svcCtx) - resp, err := l.AdaptersList(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/clusterlisthandler.go b/api/internal/handler/adapters/clusterlisthandler.go deleted file mode 100644 index f1863304..00000000 --- a/api/internal/handler/adapters/clusterlisthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ClusterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ClusterReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewClusterListLogic(r.Context(), svcCtx) - resp, err := l.ClusterList(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/createadapterhandler.go b/api/internal/handler/adapters/createadapterhandler.go deleted file mode 100644 index 42b60968..00000000 --- a/api/internal/handler/adapters/createadapterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AdapterCreateReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewCreateAdapterLogic(r.Context(), svcCtx) - resp, err := l.CreateAdapter(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/createclusterhandler.go b/api/internal/handler/adapters/createclusterhandler.go deleted file mode 100644 index 80eaa0de..00000000 --- a/api/internal/handler/adapters/createclusterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ClusterCreateReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewCreateClusterLogic(r.Context(), svcCtx) - resp, err := l.CreateCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/deleteadapterhandler.go b/api/internal/handler/adapters/deleteadapterhandler.go deleted file mode 100644 index b2e1c7ca..00000000 --- a/api/internal/handler/adapters/deleteadapterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AdapterDelReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewDeleteAdapterLogic(r.Context(), svcCtx) - resp, err := l.DeleteAdapter(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/deleteclusterhandler.go b/api/internal/handler/adapters/deleteclusterhandler.go deleted file mode 100644 index 62e800f1..00000000 --- a/api/internal/handler/adapters/deleteclusterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.FId - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewDeleteClusterLogic(r.Context(), svcCtx) - resp, err := l.DeleteCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/getadapterhandler.go b/api/internal/handler/adapters/getadapterhandler.go deleted file mode 100644 index 2e4e189d..00000000 --- a/api/internal/handler/adapters/getadapterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AdapterDelReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewGetAdapterLogic(r.Context(), svcCtx) - resp, err := l.GetAdapter(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/getadapterrelationhandler.go b/api/internal/handler/adapters/getadapterrelationhandler.go deleted file mode 100644 index 13212c35..00000000 --- a/api/internal/handler/adapters/getadapterrelationhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetAdapterRelationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AdapterRelationQueryReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewGetAdapterRelationLogic(r.Context(), svcCtx) - resp, err := l.GetAdapterRelation(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/getclusterhandler.go b/api/internal/handler/adapters/getclusterhandler.go deleted file mode 100644 index 865e861f..00000000 --- a/api/internal/handler/adapters/getclusterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.FId - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewGetClusterLogic(r.Context(), svcCtx) - resp, err := l.GetCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/getclustersumhandler.go b/api/internal/handler/adapters/getclustersumhandler.go deleted file mode 100644 index 18fd747e..00000000 --- a/api/internal/handler/adapters/getclustersumhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetClusterSumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ClusterSumReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewGetClusterSumLogic(r.Context(), svcCtx) - resp, err := l.GetClusterSum(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/updateadapterhandler.go b/api/internal/handler/adapters/updateadapterhandler.go deleted file mode 100644 index 3800fc16..00000000 --- a/api/internal/handler/adapters/updateadapterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AdapterReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewUpdateAdapterLogic(r.Context(), svcCtx) - resp, err := l.UpdateAdapter(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/updateclusterhandler.go b/api/internal/handler/adapters/updateclusterhandler.go deleted file mode 100644 index f5405d64..00000000 --- a/api/internal/handler/adapters/updateclusterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ClusterCreateReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewUpdateClusterLogic(r.Context(), svcCtx) - resp, err := l.UpdateCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/createalgorithmhandler.go b/api/internal/handler/ai/createalgorithmhandler.go deleted file mode 100644 index e0ebcb34..00000000 --- a/api/internal/handler/ai/createalgorithmhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateAlgorithmReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewCreateAlgorithmLogic(r.Context(), svcCtx) - resp, err := l.CreateAlgorithm(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/createdatasethandler.go b/api/internal/handler/ai/createdatasethandler.go deleted file mode 100644 index 57bb2728..00000000 --- a/api/internal/handler/ai/createdatasethandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateDataSetReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewCreateDataSetLogic(r.Context(), svcCtx) - resp, err := l.CreateDataSet(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/createexporttaskhandler.go b/api/internal/handler/ai/createexporttaskhandler.go deleted file mode 100644 index bcc64381..00000000 --- a/api/internal/handler/ai/createexporttaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateExportTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateExportTaskReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewCreateExportTaskLogic(r.Context(), svcCtx) - resp, err := l.CreateExportTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/createnotebookhandler.go b/api/internal/handler/ai/createnotebookhandler.go deleted file mode 100644 index 4bf997fc..00000000 --- a/api/internal/handler/ai/createnotebookhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateNotebookReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewCreateNotebookLogic(r.Context(), svcCtx) - resp, err := l.CreateNotebook(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/createprocessortaskhandler.go b/api/internal/handler/ai/createprocessortaskhandler.go deleted file mode 100644 index b2dc6f55..00000000 --- a/api/internal/handler/ai/createprocessortaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateProcessorTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateProcessorTaskReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewCreateProcessorTaskLogic(r.Context(), svcCtx) - resp, err := l.CreateProcessorTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/createservicehandler.go b/api/internal/handler/ai/createservicehandler.go deleted file mode 100644 index dd8ef32a..00000000 --- a/api/internal/handler/ai/createservicehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateServiceReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewCreateServiceLogic(r.Context(), svcCtx) - resp, err := l.CreateService(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/createtaskhandler.go b/api/internal/handler/ai/createtaskhandler.go deleted file mode 100644 index c1632e63..00000000 --- a/api/internal/handler/ai/createtaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ImportTaskDataReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewCreateTaskLogic(r.Context(), svcCtx) - resp, err := l.CreateTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/createtrainingjobhandler.go b/api/internal/handler/ai/createtrainingjobhandler.go deleted file mode 100644 index f159bf06..00000000 --- a/api/internal/handler/ai/createtrainingjobhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateTrainingJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateTrainingJobReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewCreateTrainingJobLogic(r.Context(), svcCtx) - resp, err := l.CreateTrainingJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/createvisualizationjobhandler.go b/api/internal/handler/ai/createvisualizationjobhandler.go deleted file mode 100644 index b66ffa7c..00000000 --- a/api/internal/handler/ai/createvisualizationjobhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateVisualizationJobReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewCreateVisualizationJobLogic(r.Context(), svcCtx) - resp, err := l.CreateVisualizationJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/deletealgorithmhandler.go b/api/internal/handler/ai/deletealgorithmhandler.go deleted file mode 100644 index 57630af0..00000000 --- a/api/internal/handler/ai/deletealgorithmhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteAlgorithmReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewDeleteAlgorithmLogic(r.Context(), svcCtx) - resp, err := l.DeleteAlgorithm(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/deletedatasethandler.go b/api/internal/handler/ai/deletedatasethandler.go deleted file mode 100644 index 84288d1c..00000000 --- a/api/internal/handler/ai/deletedatasethandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteDataSetReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewDeleteDataSetLogic(r.Context(), svcCtx) - resp, err := l.DeleteDataSet(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/deleteservicehandler.go b/api/internal/handler/ai/deleteservicehandler.go deleted file mode 100644 index effb9aad..00000000 --- a/api/internal/handler/ai/deleteservicehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteServiceReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewDeleteServiceLogic(r.Context(), svcCtx) - resp, err := l.DeleteService(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/deletetrainingjobhandler.go b/api/internal/handler/ai/deletetrainingjobhandler.go deleted file mode 100644 index d0666ef7..00000000 --- a/api/internal/handler/ai/deletetrainingjobhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteTrainingJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteTrainingJobReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewDeleteTrainingJobLogic(r.Context(), svcCtx) - resp, err := l.DeleteTrainingJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/getexporttasksofdatasethandler.go b/api/internal/handler/ai/getexporttasksofdatasethandler.go deleted file mode 100644 index bf45832a..00000000 --- a/api/internal/handler/ai/getexporttasksofdatasethandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetExportTasksOfDatasetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetExportTasksOfDatasetReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewGetExportTasksOfDatasetLogic(r.Context(), svcCtx) - resp, err := l.GetExportTasksOfDataset(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go b/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go deleted file mode 100644 index 3a7c0337..00000000 --- a/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetExportTaskStatusOfDatasetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetExportTaskStatusOfDatasetReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewGetExportTaskStatusOfDatasetLogic(r.Context(), svcCtx) - resp, err := l.GetExportTaskStatusOfDataset(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/getlisttrainingjobshandler.go b/api/internal/handler/ai/getlisttrainingjobshandler.go deleted file mode 100644 index 3f978dba..00000000 --- a/api/internal/handler/ai/getlisttrainingjobshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetListTrainingJobsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListTrainingJobsreq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewGetListTrainingJobsLogic(r.Context(), svcCtx) - resp, err := l.GetListTrainingJobs(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/getnotebookstoragehandler.go b/api/internal/handler/ai/getnotebookstoragehandler.go deleted file mode 100644 index 2c7618c8..00000000 --- a/api/internal/handler/ai/getnotebookstoragehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetNotebookStorageReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewGetNotebookStorageLogic(r.Context(), svcCtx) - resp, err := l.GetNotebookStorage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/getvisualizationjobhandler.go b/api/internal/handler/ai/getvisualizationjobhandler.go deleted file mode 100644 index 51f41ed1..00000000 --- a/api/internal/handler/ai/getvisualizationjobhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetVisualizationJobReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewGetVisualizationJobLogic(r.Context(), svcCtx) - resp, err := l.GetVisualizationJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/listalgorithmshandler.go b/api/internal/handler/ai/listalgorithmshandler.go deleted file mode 100644 index 56c2ded7..00000000 --- a/api/internal/handler/ai/listalgorithmshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListAlgorithmsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListAlgorithmsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewListAlgorithmsLogic(r.Context(), svcCtx) - resp, err := l.ListAlgorithms(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/listclustershandler.go b/api/internal/handler/ai/listclustershandler.go deleted file mode 100644 index 50ad73bd..00000000 --- a/api/internal/handler/ai/listclustershandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListClustersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListClustersReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewListClustersLogic(r.Context(), svcCtx) - resp, err := l.ListClusters(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/listdatasethandler.go b/api/internal/handler/ai/listdatasethandler.go deleted file mode 100644 index 78f06ffa..00000000 --- a/api/internal/handler/ai/listdatasethandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DataSetReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewListDataSetLogic(r.Context(), svcCtx) - resp, err := l.ListDataSet(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/listimporthandler.go b/api/internal/handler/ai/listimporthandler.go deleted file mode 100644 index 32a8c6d0..00000000 --- a/api/internal/handler/ai/listimporthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListImportHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListImportTasksReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewListImportLogic(r.Context(), svcCtx) - resp, err := l.ListImport(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/listnotebookhandler.go b/api/internal/handler/ai/listnotebookhandler.go deleted file mode 100644 index b1375aeb..00000000 --- a/api/internal/handler/ai/listnotebookhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListNotebookReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewListNotebookLogic(r.Context(), svcCtx) - resp, err := l.ListNotebook(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/listserviceshandler.go b/api/internal/handler/ai/listserviceshandler.go deleted file mode 100644 index df823191..00000000 --- a/api/internal/handler/ai/listserviceshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListServicesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListServicesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewListServicesLogic(r.Context(), svcCtx) - resp, err := l.ListServices(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/mountnotebookstoragehandler.go b/api/internal/handler/ai/mountnotebookstoragehandler.go deleted file mode 100644 index 324c9708..00000000 --- a/api/internal/handler/ai/mountnotebookstoragehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func MountNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.MountNotebookStorageReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewMountNotebookStorageLogic(r.Context(), svcCtx) - resp, err := l.MountNotebookStorage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/showalgorithmbyuuidhandler.go b/api/internal/handler/ai/showalgorithmbyuuidhandler.go deleted file mode 100644 index a2951560..00000000 --- a/api/internal/handler/ai/showalgorithmbyuuidhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowAlgorithmByUuidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowAlgorithmByUuidReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewShowAlgorithmByUuidLogic(r.Context(), svcCtx) - resp, err := l.ShowAlgorithmByUuid(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/showservicehandler.go b/api/internal/handler/ai/showservicehandler.go deleted file mode 100644 index d6a9f4b4..00000000 --- a/api/internal/handler/ai/showservicehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowServiceReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewShowServiceLogic(r.Context(), svcCtx) - resp, err := l.ShowService(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/startnotebookhandler.go b/api/internal/handler/ai/startnotebookhandler.go deleted file mode 100644 index 1416d911..00000000 --- a/api/internal/handler/ai/startnotebookhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func StartNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.StartNotebookReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewStartNotebookLogic(r.Context(), svcCtx) - resp, err := l.StartNotebook(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/stopnotebookhandler.go b/api/internal/handler/ai/stopnotebookhandler.go deleted file mode 100644 index b6fd7cce..00000000 --- a/api/internal/handler/ai/stopnotebookhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func StopNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.StopNotebookReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewStopNotebookLogic(r.Context(), svcCtx) - resp, err := l.StopNotebook(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/apps/appdetailhandler.go b/api/internal/handler/apps/appdetailhandler.go deleted file mode 100644 index d668a226..00000000 --- a/api/internal/handler/apps/appdetailhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package apps - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func AppDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AppDetailReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := apps.NewAppDetailLogic(r.Context(), svcCtx) - resp, err := l.AppDetail(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/apps/applisthandler.go b/api/internal/handler/apps/applisthandler.go deleted file mode 100644 index 823cb985..00000000 --- a/api/internal/handler/apps/applisthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package apps - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func AppListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AppListReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := apps.NewAppListLogic(r.Context(), svcCtx) - resp, err := l.AppList(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/apps/apppodshandler.go b/api/internal/handler/apps/apppodshandler.go deleted file mode 100644 index ef3e0466..00000000 --- a/api/internal/handler/apps/apppodshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package apps - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func AppPodsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AppDetailReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := apps.NewAppPodsLogic(r.Context(), svcCtx) - resp, err := l.AppPods(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/apps/deleteappbyappnamehandler.go b/api/internal/handler/apps/deleteappbyappnamehandler.go deleted file mode 100644 index a6c9efa6..00000000 --- a/api/internal/handler/apps/deleteappbyappnamehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package apps - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteAppReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := apps.NewDeleteAppByAppNameLogic(r.Context(), svcCtx) - resp, err := l.DeleteAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/apps/getappbyappnamehandler.go b/api/internal/handler/apps/getappbyappnamehandler.go deleted file mode 100644 index d7dd16c2..00000000 --- a/api/internal/handler/apps/getappbyappnamehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package apps - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AppDetailReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := apps.NewGetAppByAppNameLogic(r.Context(), svcCtx) - resp, err := l.GetAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/apps/pauseappbyappnamehandler.go b/api/internal/handler/apps/pauseappbyappnamehandler.go deleted file mode 100644 index a53de1ab..00000000 --- a/api/internal/handler/apps/pauseappbyappnamehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package apps - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func PauseAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteAppReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := apps.NewPauseAppByAppNameLogic(r.Context(), svcCtx) - resp, err := l.PauseAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/apps/restartappbyappnamehandler.go b/api/internal/handler/apps/restartappbyappnamehandler.go deleted file mode 100644 index 94b246af..00000000 --- a/api/internal/handler/apps/restartappbyappnamehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package apps - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func RestartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteAppReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := apps.NewRestartAppByAppNameLogic(r.Context(), svcCtx) - resp, err := l.RestartAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/apps/startappbyappnamehandler.go b/api/internal/handler/apps/startappbyappnamehandler.go deleted file mode 100644 index 02b6a98b..00000000 --- a/api/internal/handler/apps/startappbyappnamehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package apps - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func StartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteAppReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := apps.NewStartAppByAppNameLogic(r.Context(), svcCtx) - resp, err := l.StartAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/apps/updateappbyappnamehandler.go b/api/internal/handler/apps/updateappbyappnamehandler.go deleted file mode 100644 index e72740b8..00000000 --- a/api/internal/handler/apps/updateappbyappnamehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package apps - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteAppReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := apps.NewUpdateAppByAppNameLogic(r.Context(), svcCtx) - resp, err := l.UpdateAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/cloud/cloudlisthandler.go b/api/internal/handler/cloud/cloudlisthandler.go deleted file mode 100644 index 22c759c4..00000000 --- a/api/internal/handler/cloud/cloudlisthandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package cloud - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func CloudListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := cloud.NewCloudListLogic(r.Context(), svcCtx) - resp, err := l.CloudList() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/cloud/controllermetricshandler.go b/api/internal/handler/cloud/controllermetricshandler.go deleted file mode 100644 index 2e02cf43..00000000 --- a/api/internal/handler/cloud/controllermetricshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package cloud - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ControllerMetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ControllerMetricsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := cloud.NewControllerMetricsLogic(r.Context(), svcCtx) - resp, err := l.ControllerMetrics(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/cloud/deleteclusterhandler.go b/api/internal/handler/cloud/deleteclusterhandler.go deleted file mode 100644 index 323c25f3..00000000 --- a/api/internal/handler/cloud/deleteclusterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package cloud - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteClusterReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := cloud.NewDeleteClusterLogic(r.Context(), svcCtx) - resp, err := l.DeleteCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/cloud/deleteyamlhandler.go b/api/internal/handler/cloud/deleteyamlhandler.go deleted file mode 100644 index 60a01556..00000000 --- a/api/internal/handler/cloud/deleteyamlhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package cloud - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteYamlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ApplyReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := cloud.NewDeleteYamlLogic(r.Context(), svcCtx) - resp, err := l.DeleteYaml(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/cloud/getclusterlisthandler.go b/api/internal/handler/cloud/getclusterlisthandler.go deleted file mode 100644 index cc04e75d..00000000 --- a/api/internal/handler/cloud/getclusterlisthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package cloud - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetClusterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetClusterListReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := cloud.NewGetClusterListLogic(r.Context(), svcCtx) - resp, err := l.GetClusterList(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/cloud/noticetenanthandler.go b/api/internal/handler/cloud/noticetenanthandler.go deleted file mode 100644 index 9b3fea29..00000000 --- a/api/internal/handler/cloud/noticetenanthandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package cloud - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func NoticeTenantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := cloud.NewNoticeTenantLogic(r.Context(), svcCtx) - resp, err := l.NoticeTenant() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/cloud/registerclusterhandler.go b/api/internal/handler/cloud/registerclusterhandler.go deleted file mode 100644 index f222e5be..00000000 --- a/api/internal/handler/cloud/registerclusterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package cloud - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func RegisterClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.RegisterClusterReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := cloud.NewRegisterClusterLogic(r.Context(), svcCtx) - resp, err := l.RegisterCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/cloud/updatetenanthandler.go b/api/internal/handler/cloud/updatetenanthandler.go deleted file mode 100644 index 04b04e32..00000000 --- a/api/internal/handler/cloud/updatetenanthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package cloud - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateTenantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateTenantReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := cloud.NewUpdateTenantLogic(r.Context(), svcCtx) - resp, err := l.UpdateTenant(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/centerresourceshandler.go b/api/internal/handler/core/centerresourceshandler.go deleted file mode 100644 index 6c7ae71e..00000000 --- a/api/internal/handler/core/centerresourceshandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func CenterResourcesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewCenterResourcesLogic(r.Context(), svcCtx) - resp, err := l.CenterResources() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/committaskhandler.go b/api/internal/handler/core/committaskhandler.go deleted file mode 100644 index 3bea0b93..00000000 --- a/api/internal/handler/core/committaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CommitTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CommitTaskReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewCommitTaskLogic(r.Context(), svcCtx) - err := l.CommitTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } - } -} diff --git a/api/internal/handler/core/commitvmtaskhandler.go b/api/internal/handler/core/commitvmtaskhandler.go deleted file mode 100644 index f2ca9e4b..00000000 --- a/api/internal/handler/core/commitvmtaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CommitVmTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CommitVmTaskReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewCommitVmTaskLogic(r.Context(), svcCtx) - resp, err := l.CommitVmTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/deletetaskhandler.go b/api/internal/handler/core/deletetaskhandler.go deleted file mode 100644 index e5a735e0..00000000 --- a/api/internal/handler/core/deletetaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteTaskReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewDeleteTaskLogic(r.Context(), svcCtx) - err := l.DeleteTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } - } -} diff --git a/api/internal/handler/core/getcomputilitystatisticshandler.go b/api/internal/handler/core/getcomputilitystatisticshandler.go deleted file mode 100644 index 8a03ba36..00000000 --- a/api/internal/handler/core/getcomputilitystatisticshandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func GetComputilityStatisticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewGetComputilityStatisticsLogic(r.Context(), svcCtx) - resp, err := l.GetComputilityStatistics() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/getcomputingpowerhandler.go b/api/internal/handler/core/getcomputingpowerhandler.go deleted file mode 100644 index 9e4c77ed..00000000 --- a/api/internal/handler/core/getcomputingpowerhandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func GetComputingPowerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewGetComputingPowerLogic(r.Context(), svcCtx) - resp, err := l.GetComputingPower() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/getgeneralinfohandler.go b/api/internal/handler/core/getgeneralinfohandler.go deleted file mode 100644 index de4dc89f..00000000 --- a/api/internal/handler/core/getgeneralinfohandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func GetGeneralInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewGetGeneralInfoLogic(r.Context(), svcCtx) - resp, err := l.GetGeneralInfo() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/getregionhandler.go b/api/internal/handler/core/getregionhandler.go deleted file mode 100644 index f85e16c7..00000000 --- a/api/internal/handler/core/getregionhandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func GetRegionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewGetRegionLogic(r.Context(), svcCtx) - resp, err := l.GetRegion() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/getresourcepanelconfighandler.go b/api/internal/handler/core/getresourcepanelconfighandler.go deleted file mode 100644 index 45dde0c1..00000000 --- a/api/internal/handler/core/getresourcepanelconfighandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func GetResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewGetResourcePanelConfigLogic(r.Context(), svcCtx) - resp, err := l.GetResourcePanelConfig() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/jobtotalhandler.go b/api/internal/handler/core/jobtotalhandler.go deleted file mode 100644 index 91caa200..00000000 --- a/api/internal/handler/core/jobtotalhandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func JobTotalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewJobTotalLogic(r.Context(), svcCtx) - resp, err := l.JobTotal() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/listcenterhandler.go b/api/internal/handler/core/listcenterhandler.go deleted file mode 100644 index cf988c03..00000000 --- a/api/internal/handler/core/listcenterhandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ListCenterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewListCenterLogic(r.Context(), svcCtx) - resp, err := l.ListCenter() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/listclusterhandler.go b/api/internal/handler/core/listclusterhandler.go deleted file mode 100644 index a2077a06..00000000 --- a/api/internal/handler/core/listclusterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListClusterReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewListClusterLogic(r.Context(), svcCtx) - resp, err := l.ListCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/listdomainresourcehandler.go b/api/internal/handler/core/listdomainresourcehandler.go deleted file mode 100644 index 911beacf..00000000 --- a/api/internal/handler/core/listdomainresourcehandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ListDomainResourceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewListDomainResourceLogic(r.Context(), svcCtx) - resp, err := l.ListDomainResource() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/listregionhandler.go b/api/internal/handler/core/listregionhandler.go deleted file mode 100644 index c05760a6..00000000 --- a/api/internal/handler/core/listregionhandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ListRegionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewListRegionLogic(r.Context(), svcCtx) - resp, err := l.ListRegion() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/metricshandler.go b/api/internal/handler/core/metricshandler.go deleted file mode 100644 index 5f715b1d..00000000 --- a/api/internal/handler/core/metricshandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func MetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewMetricsLogic(r.Context(), svcCtx) - err := l.Metrics() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } - } -} diff --git a/api/internal/handler/core/nodeassetshandler.go b/api/internal/handler/core/nodeassetshandler.go deleted file mode 100644 index f8bd04a4..00000000 --- a/api/internal/handler/core/nodeassetshandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func NodeAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewNodeAssetsLogic(r.Context(), svcCtx) - resp, err := l.NodeAssets() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/participantlisthandler.go b/api/internal/handler/core/participantlisthandler.go deleted file mode 100644 index 1f122e0f..00000000 --- a/api/internal/handler/core/participantlisthandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ParticipantListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewParticipantListLogic(r.Context(), svcCtx) - resp, err := l.ParticipantList() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/pulltaskinfohandler.go b/api/internal/handler/core/pulltaskinfohandler.go deleted file mode 100644 index 87e8cccc..00000000 --- a/api/internal/handler/core/pulltaskinfohandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func PullTaskInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.PullTaskInfoReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewPullTaskInfoLogic(r.Context(), svcCtx) - resp, err := l.PullTaskInfo(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/pushtaskinfohandler.go b/api/internal/handler/core/pushtaskinfohandler.go deleted file mode 100644 index 68c4637d..00000000 --- a/api/internal/handler/core/pushtaskinfohandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func PushTaskInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.PushTaskInfoReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewPushTaskInfoLogic(r.Context(), svcCtx) - resp, err := l.PushTaskInfo(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/putresourcepanelconfighandler.go b/api/internal/handler/core/putresourcepanelconfighandler.go deleted file mode 100644 index a425f19a..00000000 --- a/api/internal/handler/core/putresourcepanelconfighandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func PutResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ResourcePanelConfigReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewPutResourcePanelConfigLogic(r.Context(), svcCtx) - err := l.PutResourcePanelConfig(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } - } -} diff --git a/api/internal/handler/core/scheduletaskbyyamlhandler.go b/api/internal/handler/core/scheduletaskbyyamlhandler.go deleted file mode 100644 index 1841a389..00000000 --- a/api/internal/handler/core/scheduletaskbyyamlhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ScheduleTaskByYamlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ScheduleTaskByYamlReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewScheduleTaskByYamlLogic(r.Context(), svcCtx) - err := l.ScheduleTaskByYaml(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } - } -} diff --git a/api/internal/handler/core/syncclusterloadhandler.go b/api/internal/handler/core/syncclusterloadhandler.go deleted file mode 100644 index ff36e15b..00000000 --- a/api/internal/handler/core/syncclusterloadhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func SyncClusterLoadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.SyncClusterLoadReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewSyncClusterLoadLogic(r.Context(), svcCtx) - err := l.SyncClusterLoad(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } - } -} diff --git a/api/internal/handler/core/taskdetailhandler.go b/api/internal/handler/core/taskdetailhandler.go deleted file mode 100644 index e97f2706..00000000 --- a/api/internal/handler/core/taskdetailhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func TaskDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.TaskDetailReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewTaskDetailLogic(r.Context(), svcCtx) - resp, err := l.TaskDetail(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/tasklisthandler.go b/api/internal/handler/core/tasklisthandler.go deleted file mode 100644 index 7b239009..00000000 --- a/api/internal/handler/core/tasklisthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func TaskListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.TaskListReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewTaskListLogic(r.Context(), svcCtx) - resp, err := l.TaskList(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/adddicthandler.go b/api/internal/handler/dictionary/adddicthandler.go deleted file mode 100644 index 9abc0f7a..00000000 --- a/api/internal/handler/dictionary/adddicthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func AddDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DictEditReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewAddDictLogic(r.Context(), svcCtx) - resp, err := l.AddDict(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/adddictitemhandler.go b/api/internal/handler/dictionary/adddictitemhandler.go deleted file mode 100644 index c1ab2c69..00000000 --- a/api/internal/handler/dictionary/adddictitemhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func AddDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DictItemEditReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewAddDictItemLogic(r.Context(), svcCtx) - resp, err := l.AddDictItem(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/deletedicthandler.go b/api/internal/handler/dictionary/deletedicthandler.go deleted file mode 100644 index 435f529e..00000000 --- a/api/internal/handler/dictionary/deletedicthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CId - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewDeleteDictLogic(r.Context(), svcCtx) - resp, err := l.DeleteDict(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/deletedictitemhandler.go b/api/internal/handler/dictionary/deletedictitemhandler.go deleted file mode 100644 index e029202f..00000000 --- a/api/internal/handler/dictionary/deletedictitemhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CId - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewDeleteDictItemLogic(r.Context(), svcCtx) - resp, err := l.DeleteDictItem(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/editdicthandler.go b/api/internal/handler/dictionary/editdicthandler.go deleted file mode 100644 index b63e41be..00000000 --- a/api/internal/handler/dictionary/editdicthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func EditDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DictEditReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewEditDictLogic(r.Context(), svcCtx) - resp, err := l.EditDict(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/editdictitemhandler.go b/api/internal/handler/dictionary/editdictitemhandler.go deleted file mode 100644 index f4f2fd6c..00000000 --- a/api/internal/handler/dictionary/editdictitemhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func EditDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DictItemEditReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewEditDictItemLogic(r.Context(), svcCtx) - resp, err := l.EditDictItem(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/getdicthandler.go b/api/internal/handler/dictionary/getdicthandler.go deleted file mode 100644 index 4a958990..00000000 --- a/api/internal/handler/dictionary/getdicthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CId - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewGetDictLogic(r.Context(), svcCtx) - resp, err := l.GetDict(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/getdictitemhandler.go b/api/internal/handler/dictionary/getdictitemhandler.go deleted file mode 100644 index 60d8ce06..00000000 --- a/api/internal/handler/dictionary/getdictitemhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CId - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewGetDictItemLogic(r.Context(), svcCtx) - resp, err := l.GetDictItem(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/listdicthandler.go b/api/internal/handler/dictionary/listdicthandler.go deleted file mode 100644 index 5c34a136..00000000 --- a/api/internal/handler/dictionary/listdicthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DictReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewListDictLogic(r.Context(), svcCtx) - resp, err := l.ListDict(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/listdictitembycodehandler.go b/api/internal/handler/dictionary/listdictitembycodehandler.go deleted file mode 100644 index 98c6feab..00000000 --- a/api/internal/handler/dictionary/listdictitembycodehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListDictItemByCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DictCodeReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewListDictItemByCodeLogic(r.Context(), svcCtx) - resp, err := l.ListDictItemByCode(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/listdictitemhandler.go b/api/internal/handler/dictionary/listdictitemhandler.go deleted file mode 100644 index 5607ee04..00000000 --- a/api/internal/handler/dictionary/listdictitemhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DictItemReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewListDictItemLogic(r.Context(), svcCtx) - resp, err := l.ListDictItem(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/hpc/commithpctaskhandler.go b/api/internal/handler/hpc/commithpctaskhandler.go deleted file mode 100644 index a2043def..00000000 --- a/api/internal/handler/hpc/commithpctaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package hpc - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CommitHpcTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CommitHpcTaskReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := hpc.NewCommitHpcTaskLogic(r.Context(), svcCtx) - resp, err := l.CommitHpcTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/hpc/listhistoryjobhandler.go b/api/internal/handler/hpc/listhistoryjobhandler.go deleted file mode 100644 index ec50c854..00000000 --- a/api/internal/handler/hpc/listhistoryjobhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package hpc - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListHistoryJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListHistoryJobReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := hpc.NewListHistoryJobLogic(r.Context(), svcCtx) - resp, err := l.ListHistoryJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/hpc/listjobhandler.go b/api/internal/handler/hpc/listjobhandler.go deleted file mode 100644 index c9572a7e..00000000 --- a/api/internal/handler/hpc/listjobhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package hpc - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListJobReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := hpc.NewListJobLogic(r.Context(), svcCtx) - resp, err := l.ListJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/hpc/queueassetshandler.go b/api/internal/handler/hpc/queueassetshandler.go deleted file mode 100644 index 97c0c5d4..00000000 --- a/api/internal/handler/hpc/queueassetshandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package hpc - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func QueueAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := hpc.NewQueueAssetsLogic(r.Context(), svcCtx) - resp, err := l.QueueAssets() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/image/chunkhandler.go b/api/internal/handler/image/chunkhandler.go deleted file mode 100644 index 87c8b143..00000000 --- a/api/internal/handler/image/chunkhandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package image - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ChunkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := image.NewChunkLogic(r.Context(), svcCtx) - err := l.Chunk() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } - } -} diff --git a/api/internal/handler/image/datasetcheckhandler.go b/api/internal/handler/image/datasetcheckhandler.go deleted file mode 100644 index b127987b..00000000 --- a/api/internal/handler/image/datasetcheckhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package image - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DataSetCheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CheckReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := image.NewDataSetCheckLogic(r.Context(), svcCtx) - resp, err := l.DataSetCheck(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/image/imagelisthandler.go b/api/internal/handler/image/imagelisthandler.go deleted file mode 100644 index cbd14726..00000000 --- a/api/internal/handler/image/imagelisthandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package image - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ImageListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := image.NewImageListLogic(r.Context(), svcCtx) - resp, err := l.ImageList() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/image/uploaddatasethandler.go b/api/internal/handler/image/uploaddatasethandler.go deleted file mode 100644 index ffe715c6..00000000 --- a/api/internal/handler/image/uploaddatasethandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package image - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func UploadDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := image.NewUploadDataSetLogic(r.Context(), svcCtx) - err := l.UploadDataSet() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } - } -} diff --git a/api/internal/handler/image/uploadhandler.go b/api/internal/handler/image/uploadhandler.go deleted file mode 100644 index 66cd4592..00000000 --- a/api/internal/handler/image/uploadhandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package image - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func UploadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := image.NewUploadLogic(r.Context(), svcCtx) - err := l.Upload() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } - } -} diff --git a/api/internal/handler/routes.go b/api/internal/handler/routes.go deleted file mode 100644 index 50f31d6c..00000000 --- a/api/internal/handler/routes.go +++ /dev/null @@ -1,1166 +0,0 @@ -// Code generated by goctl. DO NOT EDIT. -package handler - -import ( - "net/http" - - adapters "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/adapters" - ai "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/ai" - apps "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/apps" - cloud "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/cloud" - core "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/core" - dictionary "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/dictionary" - hpc "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/hpc" - image "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/image" - schedule "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/schedule" - storage "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/storage" - storelink "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/storelink" - vm "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - - "github.com/zeromicro/go-zero/rest" -) - -func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodGet, - Path: "/core/participantList", - Handler: core.ParticipantListHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/core/scheduleTaskByYaml", - Handler: core.ScheduleTaskByYamlHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/core/commitTask", - Handler: core.CommitTaskHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/core/commitVmTask", - Handler: core.CommitVmTaskHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/core/deleteTask/:id", - Handler: core.DeleteTaskHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/taskList", - Handler: core.TaskListHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/taskDetail/:taskId", - Handler: core.TaskDetailHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/jobTotal", - Handler: core.JobTotalHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/listCenter", - Handler: core.ListCenterHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/listCluster/:centerId", - Handler: core.ListClusterHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/getRegion", - Handler: core.GetRegionHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/listRegion", - Handler: core.ListRegionHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/getComputingPower", - Handler: core.GetComputingPowerHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/getGeneralInfo", - Handler: core.GetGeneralInfoHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/listDomainResource", - Handler: core.ListDomainResourceHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/getResourcePanelConfigHandler", - Handler: core.GetResourcePanelConfigHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/core/resourcePanelConfigHandler", - Handler: core.PutResourcePanelConfigHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/getComputilityStatistics", - Handler: core.GetComputilityStatisticsHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/assets", - Handler: core.NodeAssetsHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/centerResources", - Handler: core.CenterResourcesHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/core/syncClusterLoad", - Handler: core.SyncClusterLoadHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/metrics", - Handler: core.MetricsHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/pullTaskInfo", - Handler: core.PullTaskInfoHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/core/pushTaskInfo", - Handler: core.PushTaskInfoHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodPost, - Path: "/hpc/commitHpcTask", - Handler: hpc.CommitHpcTaskHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/hpc/listJob", - Handler: hpc.ListJobHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/hpc/listHistoryJob", - Handler: hpc.ListHistoryJobHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/hpc/queueAssets", - Handler: hpc.QueueAssetsHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodGet, - Path: "/task/list", - Handler: cloud.CloudListHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/cloud/DeleteYaml", - Handler: cloud.DeleteYamlHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/cloud/controller/Metrics", - Handler: cloud.ControllerMetricsHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/cloud/registerCluster", - Handler: cloud.RegisterClusterHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/cloud/deleteCluster", - Handler: cloud.DeleteClusterHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/cloud/noticeTenant", - Handler: cloud.NoticeTenantHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/cloud/updateTenant", - Handler: cloud.UpdateTenantHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/clusterList", - Handler: cloud.GetClusterListHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodGet, - Path: "/ai/listDataSet/:projectId", - Handler: ai.ListDataSetHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/createDataSet/:projectId", - Handler: ai.CreateDataSetHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/ai/deleteDataSet/:projectId/:datasetId", - Handler: ai.DeleteDataSetHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/CreateTask/:projectId/:datasetId", - Handler: ai.CreateTaskHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/ListImport/:projectId/:datasetId", - Handler: ai.ListImportHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/GetListTrainingJobs/:projectId", - Handler: ai.GetListTrainingJobsHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/ai/DeleteTrainingJob/:projectId/:trainingJobId", - Handler: ai.DeleteTrainingJobHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/CreateAlgorithm/:projectId", - Handler: ai.CreateAlgorithmHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/ListAlgorithms/:projectId", - Handler: ai.ListAlgorithmsHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/ai/DeleteAlgorithm/:projectId/:algorithmId", - Handler: ai.DeleteAlgorithmHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/CreateTrainingJob/:projectId", - Handler: ai.CreateTrainingJobHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/ShowAlgorithmByUuid/:projectId/:algorithmId", - Handler: ai.ShowAlgorithmByUuidHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/CreateExportTask/:projectId/:datasetId", - Handler: ai.CreateExportTaskHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/GetExportTasksOfDataset/:projectId/:datasetId", - Handler: ai.GetExportTasksOfDatasetHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/GetExportTaskStatusOfDataset/:projectId/:resourceId/:taskId", - Handler: ai.GetExportTaskStatusOfDatasetHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/CreateProcessorTask", - Handler: ai.CreateProcessorTaskHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/CreateService/:projectId", - Handler: ai.CreateServiceHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/ListServices/:projectId", - Handler: ai.ListServicesHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/ShowService/:projectId/:serviceId", - Handler: ai.ShowServiceHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/ai/DeleteService/:projectId/:serviceId", - Handler: ai.DeleteServiceHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/ListClusters", - Handler: ai.ListClustersHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/listNotebook", - Handler: ai.ListNotebookHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/createNotebook", - Handler: ai.CreateNotebookHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/startNotebook", - Handler: ai.StartNotebookHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/stopNotebook", - Handler: ai.StopNotebookHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/getNotebookStorage", - Handler: ai.GetNotebookStorageHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/mountNotebookStorage", - Handler: ai.MountNotebookStorageHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/getVisualizationJob", - Handler: ai.GetVisualizationJobHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/CreateVisualizationJob", - Handler: ai.CreateVisualizationJobHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodGet, - Path: "/storage/screenStorage", - Handler: storage.ScreenStorageHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/storage/dailyPowerScreen", - Handler: storage.DailyPowerScreenHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/storage/perCenterComputerPowers", - Handler: storage.PerCenterComputerPowersHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodPost, - Path: "/upload", - Handler: image.UploadHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/chunk", - Handler: image.ChunkHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/image/list", - Handler: image.ImageListHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/dataSet/check/:fileMd5", - Handler: image.DataSetCheckHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/dataSet/upload", - Handler: image.UploadDataSetHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodGet, - Path: "/vm/getComputeLimits", - Handler: vm.GetComputeLimitsHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/getVolumeLimits", - Handler: vm.GetVolumeLimitsHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/getNetworkNum", - Handler: vm.GetNetworkNumHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/getImageNum", - Handler: vm.GetImageNumHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listServer", - Handler: vm.ListServerHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listServersDetailed", - Handler: vm.ListServersDetailedHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteServer", - Handler: vm.DeleteServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createServer", - Handler: vm.CreateServerHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/getServersDetailedById", - Handler: vm.GetServersDetailedByIdHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updateServer", - Handler: vm.UpdateServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/startServer", - Handler: vm.StartServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/stopServer", - Handler: vm.StopServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/rebootServer", - Handler: vm.RebootServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/pauseServer", - Handler: vm.PauseServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/unpauseServer", - Handler: vm.UnpauseServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/resizeServer", - Handler: vm.ResizeServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/migrateServer", - Handler: vm.MigrateServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/shelveServer", - Handler: vm.ShelveServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/changeAdministrativePassword", - Handler: vm.ChangeAdministrativePasswordHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/rescueServer", - Handler: vm.RescueServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/unRescueServer", - Handler: vm.UnRescueHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/suspendServer", - Handler: vm.SuspendServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/addSecurityGroupToServer", - Handler: vm.AddSecurityGroupToServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/removeSecurityGroup", - Handler: vm.RemoveSecurityGroupHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createFlavor", - Handler: vm.CreateFlavorHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/deleteFlavor", - Handler: vm.DeleteFlavorHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listImages", - Handler: vm.ListImagesHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteImage", - Handler: vm.DeleteImageHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createImage", - Handler: vm.CreateImageHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/uploadImage", - Handler: vm.UploadImageHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listNetworks", - Handler: vm.ListNetworksHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteNetwork", - Handler: vm.DeleteNetworkHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createNetwork", - Handler: vm.CreateNetworkHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createSubnet", - Handler: vm.CreateSubnetHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showNetworkDetails", - Handler: vm.ShowNetworkDetailsHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updateNetwork", - Handler: vm.UpdateNetworkHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/bulkCreateNetworks", - Handler: vm.BulkCreateNetworksHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listSubnets", - Handler: vm.ListSubnetsHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteSubnet", - Handler: vm.DeleteSubnetHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updateSubnet", - Handler: vm.UpdateSubnetHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listNetworkSegmentRanges", - Handler: vm.ListNetworkSegmentRangesRangeHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createNetworkSegmentRange", - Handler: vm.CreateNetworkSegmentRangeHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteNetworkSegmentRanges", - Handler: vm.DeleteNetworkSegmentRangesHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updateNetworkSegmentRanges", - Handler: vm.UpdateNetworkSegmentRangesHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showNetworkSegmentRangeDetails", - Handler: vm.ShowNetworkSegmentRangeDetailsHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createPort", - Handler: vm.CreatePortHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listPortsReq", - Handler: vm.ListPortsHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deletePort", - Handler: vm.DeletePortHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updatePort", - Handler: vm.UpdatePortHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showPortDetails", - Handler: vm.ShowPortDetailsHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createRouter", - Handler: vm.CreateRouterHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listRouters", - Handler: vm.ListRoutersHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteRouter", - Handler: vm.DeleteRouterHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updateRouter", - Handler: vm.UpdateRouterHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showRouterDetails", - Handler: vm.ShowRouterDetailsHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createFloatingIP", - Handler: vm.CreateFloatingIPHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listFloatingIPs", - Handler: vm.ListFloatingIPsHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteFloatingIP", - Handler: vm.DeleteFloatingIPHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updateFloatingIP", - Handler: vm.UpdateFloatingIPHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showFloatingIPDetails", - Handler: vm.ShowFloatingIPDetailsHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createFirewallGroup", - Handler: vm.CreateFirewallGroupHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listFirewallGroups", - Handler: vm.ListFirewallGroupsHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteFirewallGroup", - Handler: vm.DeleteFirewallGroupHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updateFirewallGroup", - Handler: vm.UpdateFirewallGroupHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showFirewallGroupDetails", - Handler: vm.ShowFirewallGroupDetailsHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createFirewallPolicy", - Handler: vm.CreateFirewallPolicyHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listFirewallPolicies", - Handler: vm.ListFirewallPoliciesHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteFirewallPolicy", - Handler: vm.DeleteFirewallPolicyHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showFirewallRuleDetails", - Handler: vm.ShowFirewallRuleDetailsHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showFirewallPolicyDetails", - Handler: vm.ShowFirewallPolicyDetailsHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createFirewallRule", - Handler: vm.CreateFirewallRuleHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listFirewallRules", - Handler: vm.ListFirewallRulesHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteFirewallRule", - Handler: vm.DeleteFirewallRuleHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createSecurityGroup", - Handler: vm.CreateSecurityGroupHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listSecurityGroups", - Handler: vm.ListSecurityGroupsHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteSecurityGroup", - Handler: vm.DeleteSecurityGroupHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updateSecurityGroup", - Handler: vm.UpdateSecurityGroupHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showSecurityGroup", - Handler: vm.ShowSecurityGroupHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createSecurityGroupRule", - Handler: vm.CreateSecurityGroupRuleHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listSecurityGroupRules", - Handler: vm.ListSecurityGroupRulesHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteSecurityGroupRule", - Handler: vm.DeleteSecurityGroupRuleHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showSecurityGroupRule", - Handler: vm.ShowSecurityGroupRuleHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listVolumesDetail", - Handler: vm.ListVolumesDetailHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteVolume", - Handler: vm.DeleteVolumeHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createVolume", - Handler: vm.CreateVolumeHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listFlavorsDetail", - Handler: vm.ListFlavorsDetailHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listVolumeTypes", - Handler: vm.ListVolumeTypesHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updateVolume", - Handler: vm.UpdateVolumeHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createVolumeTypes", - Handler: vm.CreateVolumeTypesHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteVolumeType", - Handler: vm.DeleteVolumeTypeHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listVolumes", - Handler: vm.ListVolumesHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/getVolumeDetailedById", - Handler: vm.GetVolumeDetailedByIdHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listNodes", - Handler: vm.ListNodesHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createNode", - Handler: vm.CreateNodeHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteNode", - Handler: vm.DeleteNodeHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showNodeDetails", - Handler: vm.ShowNodeDetailsHandler(serverCtx), - }, - }, - 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), - }, - { - Method: http.MethodDelete, - Path: "/storelink/deleteImage", - Handler: storelink.DeleteLinkImageHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/storelink/submitTask", - Handler: storelink.SubmitLinkTaskHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/storelink/getTask", - Handler: storelink.GetLinkTaskHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/storelink/deleteTask", - Handler: storelink.DeleteLinkTaskHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/storelink/getParticipants", - Handler: storelink.GetParticipantsHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/storelink/getResourceSpecs", - Handler: storelink.GetAISpecsHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodGet, - Path: "/apps/list", - Handler: apps.AppListHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/apps/distribute/:appName", - Handler: apps.AppDetailHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/apps/pods/:appName", - Handler: apps.AppPodsHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/apps/getAppByAppName/:appName", - Handler: apps.GetAppByAppNameHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/apps/deleteApp", - Handler: apps.DeleteAppByAppNameHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/apps/updateApp", - Handler: apps.UpdateAppByAppNameHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/apps/restartApp", - Handler: apps.RestartAppByAppNameHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/apps/pauseApp", - Handler: apps.PauseAppByAppNameHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/apps/startApp", - Handler: apps.StartAppByAppNameHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodGet, - Path: "/adapter/list", - Handler: adapters.AdaptersListHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/adapter/create", - Handler: adapters.CreateAdapterHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/adapter/update", - Handler: adapters.UpdateAdapterHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/adapter/delete", - Handler: adapters.DeleteAdapterHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/adapter/get", - Handler: adapters.GetAdapterHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/adapter/cluster/list", - Handler: adapters.ClusterListHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/adapter/cluster/create", - Handler: adapters.CreateClusterHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/adapter/cluster/update", - Handler: adapters.UpdateClusterHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/adapter/cluster/delete", - Handler: adapters.DeleteClusterHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/adapter/cluster/get", - Handler: adapters.GetClusterHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/adapter/relation", - Handler: adapters.GetAdapterRelationHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/adapter/clusterSum", - Handler: adapters.GetClusterSumHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodGet, - Path: "/schedule/ai/getResourceTypes", - Handler: schedule.ScheduleGetAiResourceTypesHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/schedule/ai/getTaskTypes", - Handler: schedule.ScheduleGetAiTaskTypesHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/schedule/ai/getDatasets", - Handler: schedule.ScheduleGetDatasetsHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/schedule/ai/getStrategies", - Handler: schedule.ScheduleGetStrategyHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/schedule/submit", - Handler: schedule.ScheduleSubmitHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodGet, - Path: "/dict/:id", - Handler: dictionary.GetDictHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/dicts", - Handler: dictionary.ListDictHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/dict", - Handler: dictionary.AddDictHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/dict", - Handler: dictionary.EditDictHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/dict/:id", - Handler: dictionary.DeleteDictHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/dictItem/:id", - Handler: dictionary.GetDictItemHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/dictItems", - Handler: dictionary.ListDictItemHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/dictItem", - Handler: dictionary.AddDictItemHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/dictItem", - Handler: dictionary.EditDictItemHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/dictItem/:id", - Handler: dictionary.DeleteDictItemHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/dictItem/code/:dictCode", - Handler: dictionary.ListDictItemByCodeHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) -} diff --git a/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go b/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go deleted file mode 100644 index 430786f2..00000000 --- a/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package schedule - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ScheduleGetAiResourceTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := schedule.NewScheduleGetAiResourceTypesLogic(r.Context(), svcCtx) - resp, err := l.ScheduleGetAiResourceTypes() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/schedule/schedulegetaitasktypeshandler.go b/api/internal/handler/schedule/schedulegetaitasktypeshandler.go deleted file mode 100644 index 5be11070..00000000 --- a/api/internal/handler/schedule/schedulegetaitasktypeshandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package schedule - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ScheduleGetAiTaskTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := schedule.NewScheduleGetAiTaskTypesLogic(r.Context(), svcCtx) - resp, err := l.ScheduleGetAiTaskTypes() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/schedule/schedulegetdatasetshandler.go b/api/internal/handler/schedule/schedulegetdatasetshandler.go deleted file mode 100644 index da285546..00000000 --- a/api/internal/handler/schedule/schedulegetdatasetshandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package schedule - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ScheduleGetDatasetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := schedule.NewScheduleGetDatasetsLogic(r.Context(), svcCtx) - resp, err := l.ScheduleGetDatasets() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/schedule/schedulegetstrategyhandler.go b/api/internal/handler/schedule/schedulegetstrategyhandler.go deleted file mode 100644 index 2ee88fba..00000000 --- a/api/internal/handler/schedule/schedulegetstrategyhandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package schedule - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ScheduleGetStrategyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := schedule.NewScheduleGetStrategyLogic(r.Context(), svcCtx) - resp, err := l.ScheduleGetStrategy() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/schedule/schedulesubmithandler.go b/api/internal/handler/schedule/schedulesubmithandler.go deleted file mode 100644 index a536f649..00000000 --- a/api/internal/handler/schedule/schedulesubmithandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package schedule - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ScheduleSubmitHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ScheduleReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := schedule.NewScheduleSubmitLogic(r.Context(), svcCtx) - resp, err := l.ScheduleSubmit(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storage/dailypowerscreenhandler.go b/api/internal/handler/storage/dailypowerscreenhandler.go deleted file mode 100644 index 48844f39..00000000 --- a/api/internal/handler/storage/dailypowerscreenhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storage - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storage" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DailyPowerScreenHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DailyPowerScreenReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storage.NewDailyPowerScreenLogic(r.Context(), svcCtx) - resp, err := l.DailyPowerScreen(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storage/percentercomputerpowershandler.go b/api/internal/handler/storage/percentercomputerpowershandler.go deleted file mode 100644 index 2e1b5f78..00000000 --- a/api/internal/handler/storage/percentercomputerpowershandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storage - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storage" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func PerCenterComputerPowersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.PerCenterComputerPowersReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storage.NewPerCenterComputerPowersLogic(r.Context(), svcCtx) - resp, err := l.PerCenterComputerPowers(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storage/screenstoragehandler.go b/api/internal/handler/storage/screenstoragehandler.go deleted file mode 100644 index 8a8a2bec..00000000 --- a/api/internal/handler/storage/screenstoragehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storage - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storage" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ScreenStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.StorageScreenReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storage.NewScreenStorageLogic(r.Context(), svcCtx) - resp, err := l.ScreenStorage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storelink/deletelinkimagehandler.go b/api/internal/handler/storelink/deletelinkimagehandler.go deleted file mode 100644 index fc56fe9d..00000000 --- a/api/internal/handler/storelink/deletelinkimagehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storelink - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteLinkImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteLinkImageReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storelink.NewDeleteLinkImageLogic(r.Context(), svcCtx) - resp, err := l.DeleteLinkImage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storelink/deletelinktaskhandler.go b/api/internal/handler/storelink/deletelinktaskhandler.go deleted file mode 100644 index 536b3ae9..00000000 --- a/api/internal/handler/storelink/deletelinktaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storelink - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteLinkTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteLinkTaskReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storelink.NewDeleteLinkTaskLogic(r.Context(), svcCtx) - resp, err := l.DeleteLinkTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storelink/getaispecshandler.go b/api/internal/handler/storelink/getaispecshandler.go deleted file mode 100644 index 8e97d294..00000000 --- a/api/internal/handler/storelink/getaispecshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storelink - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetAISpecsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetResourceSpecsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storelink.NewGetAISpecsLogic(r.Context(), svcCtx) - resp, err := l.GetAISpecs(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storelink/getlinkimagelisthandler.go b/api/internal/handler/storelink/getlinkimagelisthandler.go deleted file mode 100644 index b83198f6..00000000 --- a/api/internal/handler/storelink/getlinkimagelisthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storelink - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetLinkImageListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetLinkImageListReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storelink.NewGetLinkImageListLogic(r.Context(), svcCtx) - resp, err := l.GetLinkImageList(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storelink/getlinktaskhandler.go b/api/internal/handler/storelink/getlinktaskhandler.go deleted file mode 100644 index af477e23..00000000 --- a/api/internal/handler/storelink/getlinktaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storelink - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetLinkTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetLinkTaskReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storelink.NewGetLinkTaskLogic(r.Context(), svcCtx) - resp, err := l.GetLinkTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storelink/getparticipantshandler.go b/api/internal/handler/storelink/getparticipantshandler.go deleted file mode 100644 index 07c88f83..00000000 --- a/api/internal/handler/storelink/getparticipantshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storelink - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetParticipantsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetParticipantsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storelink.NewGetParticipantsLogic(r.Context(), svcCtx) - resp, err := l.GetParticipants(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storelink/submitlinktaskhandler.go b/api/internal/handler/storelink/submitlinktaskhandler.go deleted file mode 100644 index 5da13f4b..00000000 --- a/api/internal/handler/storelink/submitlinktaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storelink - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func SubmitLinkTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.SubmitLinkTaskReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storelink.NewSubmitLinkTaskLogic(r.Context(), svcCtx) - resp, err := l.SubmitLinkTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storelink/uploadlinkimagehandler.go b/api/internal/handler/storelink/uploadlinkimagehandler.go deleted file mode 100644 index 9adec263..00000000 --- a/api/internal/handler/storelink/uploadlinkimagehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storelink - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UploadLinkImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UploadLinkImageReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storelink.NewUploadLinkImageLogic(r.Context(), svcCtx) - resp, err := l.UploadLinkImage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/addsecuritygrouptoserverhandler.go b/api/internal/handler/vm/addsecuritygrouptoserverhandler.go deleted file mode 100644 index 86553cbf..00000000 --- a/api/internal/handler/vm/addsecuritygrouptoserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func AddSecurityGroupToServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AddSecurityGroupToServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewAddSecurityGroupToServerLogic(r.Context(), svcCtx) - resp, err := l.AddSecurityGroupToServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/bulkcreatenetworkshandler.go b/api/internal/handler/vm/bulkcreatenetworkshandler.go deleted file mode 100644 index 84cad5c6..00000000 --- a/api/internal/handler/vm/bulkcreatenetworkshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func BulkCreateNetworksHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.BulkCreateNetworksReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewBulkCreateNetworksLogic(r.Context(), svcCtx) - resp, err := l.BulkCreateNetworks(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/changeadministrativepasswordhandler.go b/api/internal/handler/vm/changeadministrativepasswordhandler.go deleted file mode 100644 index ecf1c6bc..00000000 --- a/api/internal/handler/vm/changeadministrativepasswordhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ChangeAdministrativePasswordHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ChangeAdministrativePasswordReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewChangeAdministrativePasswordLogic(r.Context(), svcCtx) - resp, err := l.ChangeAdministrativePassword(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createfirewallgrouphandler.go b/api/internal/handler/vm/createfirewallgrouphandler.go deleted file mode 100644 index f6f5b3a1..00000000 --- a/api/internal/handler/vm/createfirewallgrouphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateFirewallGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateFirewallGroupReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateFirewallGroupLogic(r.Context(), svcCtx) - resp, err := l.CreateFirewallGroup(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createfirewallpolicyhandler.go b/api/internal/handler/vm/createfirewallpolicyhandler.go deleted file mode 100644 index 77d8d1cf..00000000 --- a/api/internal/handler/vm/createfirewallpolicyhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateFirewallPolicyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateFirewallPolicyReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateFirewallPolicyLogic(r.Context(), svcCtx) - resp, err := l.CreateFirewallPolicy(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createfirewallrulehandler.go b/api/internal/handler/vm/createfirewallrulehandler.go deleted file mode 100644 index 3995c08a..00000000 --- a/api/internal/handler/vm/createfirewallrulehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateFirewallRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateFirewallRuleReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateFirewallRuleLogic(r.Context(), svcCtx) - resp, err := l.CreateFirewallRule(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createflavorhandler.go b/api/internal/handler/vm/createflavorhandler.go deleted file mode 100644 index f32dc8f2..00000000 --- a/api/internal/handler/vm/createflavorhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateFlavorHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateFlavorReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateFlavorLogic(r.Context(), svcCtx) - resp, err := l.CreateFlavor(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createfloatingiphandler.go b/api/internal/handler/vm/createfloatingiphandler.go deleted file mode 100644 index 797a4a55..00000000 --- a/api/internal/handler/vm/createfloatingiphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateFloatingIPHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateFloatingIPReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateFloatingIPLogic(r.Context(), svcCtx) - resp, err := l.CreateFloatingIP(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createimagehandler.go b/api/internal/handler/vm/createimagehandler.go deleted file mode 100644 index 5f5e4f81..00000000 --- a/api/internal/handler/vm/createimagehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateImageReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateImageLogic(r.Context(), svcCtx) - resp, err := l.CreateImage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createnetworkhandler.go b/api/internal/handler/vm/createnetworkhandler.go deleted file mode 100644 index 2da207be..00000000 --- a/api/internal/handler/vm/createnetworkhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateNetworkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateNetworkReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateNetworkLogic(r.Context(), svcCtx) - resp, err := l.CreateNetwork(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createnetworksegmentrangehandler.go b/api/internal/handler/vm/createnetworksegmentrangehandler.go deleted file mode 100644 index 47f7e5fa..00000000 --- a/api/internal/handler/vm/createnetworksegmentrangehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateNetworkSegmentRangeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateNetworkSegmentRangeReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateNetworkSegmentRangeLogic(r.Context(), svcCtx) - resp, err := l.CreateNetworkSegmentRange(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createnodehandler.go b/api/internal/handler/vm/createnodehandler.go deleted file mode 100644 index 5df9dd56..00000000 --- a/api/internal/handler/vm/createnodehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateNodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateNodeReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateNodeLogic(r.Context(), svcCtx) - resp, err := l.CreateNode(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createporthandler.go b/api/internal/handler/vm/createporthandler.go deleted file mode 100644 index 0ea408b7..00000000 --- a/api/internal/handler/vm/createporthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreatePortHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreatePortReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreatePortLogic(r.Context(), svcCtx) - resp, err := l.CreatePort(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createrouterhandler.go b/api/internal/handler/vm/createrouterhandler.go deleted file mode 100644 index 45390b39..00000000 --- a/api/internal/handler/vm/createrouterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateRouterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateRouterReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateRouterLogic(r.Context(), svcCtx) - resp, err := l.CreateRouter(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createsecuritygrouphandler.go b/api/internal/handler/vm/createsecuritygrouphandler.go deleted file mode 100644 index 2fcfd935..00000000 --- a/api/internal/handler/vm/createsecuritygrouphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateSecurityGroupReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateSecurityGroupLogic(r.Context(), svcCtx) - resp, err := l.CreateSecurityGroup(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createsecuritygrouprulehandler.go b/api/internal/handler/vm/createsecuritygrouprulehandler.go deleted file mode 100644 index 11ffe7ea..00000000 --- a/api/internal/handler/vm/createsecuritygrouprulehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateSecurityGroupRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateSecurityGroupRuleReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateSecurityGroupRuleLogic(r.Context(), svcCtx) - resp, err := l.CreateSecurityGroupRule(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createserverhandler.go b/api/internal/handler/vm/createserverhandler.go deleted file mode 100644 index 1afd92f1..00000000 --- a/api/internal/handler/vm/createserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateServerLogic(r.Context(), svcCtx) - resp, err := l.CreateServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createsubnethandler.go b/api/internal/handler/vm/createsubnethandler.go deleted file mode 100644 index 931121f3..00000000 --- a/api/internal/handler/vm/createsubnethandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateSubnetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateSubnetReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateSubnetLogic(r.Context(), svcCtx) - resp, err := l.CreateSubnet(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createvolumehandler.go b/api/internal/handler/vm/createvolumehandler.go deleted file mode 100644 index 4e6c56b3..00000000 --- a/api/internal/handler/vm/createvolumehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateVolumeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateVolumeReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateVolumeLogic(r.Context(), svcCtx) - resp, err := l.CreateVolume(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createvolumetypeshandler.go b/api/internal/handler/vm/createvolumetypeshandler.go deleted file mode 100644 index 955b889f..00000000 --- a/api/internal/handler/vm/createvolumetypeshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateVolumeTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateVolumeTypeReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateVolumeTypesLogic(r.Context(), svcCtx) - resp, err := l.CreateVolumeTypes(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletefirewallgrouphandler.go b/api/internal/handler/vm/deletefirewallgrouphandler.go deleted file mode 100644 index 240f1ceb..00000000 --- a/api/internal/handler/vm/deletefirewallgrouphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteFirewallGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteFirewallGroupReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteFirewallGroupLogic(r.Context(), svcCtx) - resp, err := l.DeleteFirewallGroup(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletefirewallpolicyhandler.go b/api/internal/handler/vm/deletefirewallpolicyhandler.go deleted file mode 100644 index ee0f12fa..00000000 --- a/api/internal/handler/vm/deletefirewallpolicyhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteFirewallPolicyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteFirewallPolicyReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteFirewallPolicyLogic(r.Context(), svcCtx) - resp, err := l.DeleteFirewallPolicy(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletefirewallrulehandler.go b/api/internal/handler/vm/deletefirewallrulehandler.go deleted file mode 100644 index 44c60272..00000000 --- a/api/internal/handler/vm/deletefirewallrulehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteFirewallRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteFirewallRuleReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteFirewallRuleLogic(r.Context(), svcCtx) - resp, err := l.DeleteFirewallRule(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deleteflavorhandler.go b/api/internal/handler/vm/deleteflavorhandler.go deleted file mode 100644 index 7bf5fe04..00000000 --- a/api/internal/handler/vm/deleteflavorhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteFlavorHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteFlavorReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteFlavorLogic(r.Context(), svcCtx) - resp, err := l.DeleteFlavor(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletefloatingiphandler.go b/api/internal/handler/vm/deletefloatingiphandler.go deleted file mode 100644 index 3f7abdf3..00000000 --- a/api/internal/handler/vm/deletefloatingiphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteFloatingIPHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteFloatingIPReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteFloatingIPLogic(r.Context(), svcCtx) - resp, err := l.DeleteFloatingIP(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deleteimagehandler.go b/api/internal/handler/vm/deleteimagehandler.go deleted file mode 100644 index 6ba84ce0..00000000 --- a/api/internal/handler/vm/deleteimagehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteImageReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteImageLogic(r.Context(), svcCtx) - resp, err := l.DeleteImage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletenetworkhandler.go b/api/internal/handler/vm/deletenetworkhandler.go deleted file mode 100644 index 182f3747..00000000 --- a/api/internal/handler/vm/deletenetworkhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteNetworkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteNetworkReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteNetworkLogic(r.Context(), svcCtx) - resp, err := l.DeleteNetwork(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletenetworksegmentrangeshandler.go b/api/internal/handler/vm/deletenetworksegmentrangeshandler.go deleted file mode 100644 index b4cfc237..00000000 --- a/api/internal/handler/vm/deletenetworksegmentrangeshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteNetworkSegmentRangesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteNetworkSegmentRangesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteNetworkSegmentRangesLogic(r.Context(), svcCtx) - resp, err := l.DeleteNetworkSegmentRanges(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletenodehandler.go b/api/internal/handler/vm/deletenodehandler.go deleted file mode 100644 index 19f67962..00000000 --- a/api/internal/handler/vm/deletenodehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteNodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteNodeReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteNodeLogic(r.Context(), svcCtx) - resp, err := l.DeleteNode(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deleteporthandler.go b/api/internal/handler/vm/deleteporthandler.go deleted file mode 100644 index 45d4a17a..00000000 --- a/api/internal/handler/vm/deleteporthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeletePortHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeletePortReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeletePortLogic(r.Context(), svcCtx) - resp, err := l.DeletePort(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deleterouterhandler.go b/api/internal/handler/vm/deleterouterhandler.go deleted file mode 100644 index 0184dbed..00000000 --- a/api/internal/handler/vm/deleterouterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteRouterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteRouterReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteRouterLogic(r.Context(), svcCtx) - resp, err := l.DeleteRouter(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletesecuritygrouphandler.go b/api/internal/handler/vm/deletesecuritygrouphandler.go deleted file mode 100644 index 482ba147..00000000 --- a/api/internal/handler/vm/deletesecuritygrouphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteSecurityGroupReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteSecurityGroupLogic(r.Context(), svcCtx) - resp, err := l.DeleteSecurityGroup(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletesecuritygrouprulehandler.go b/api/internal/handler/vm/deletesecuritygrouprulehandler.go deleted file mode 100644 index 5dcf49cf..00000000 --- a/api/internal/handler/vm/deletesecuritygrouprulehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteSecurityGroupRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteSecurityGroupRuleReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteSecurityGroupRuleLogic(r.Context(), svcCtx) - resp, err := l.DeleteSecurityGroupRule(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deleteserverhandler.go b/api/internal/handler/vm/deleteserverhandler.go deleted file mode 100644 index 412ee0a4..00000000 --- a/api/internal/handler/vm/deleteserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteServerLogic(r.Context(), svcCtx) - resp, err := l.DeleteServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletesubnethandler.go b/api/internal/handler/vm/deletesubnethandler.go deleted file mode 100644 index cb8e0b40..00000000 --- a/api/internal/handler/vm/deletesubnethandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteSubnetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteSubnetReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteSubnetLogic(r.Context(), svcCtx) - resp, err := l.DeleteSubnet(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletevolumehandler.go b/api/internal/handler/vm/deletevolumehandler.go deleted file mode 100644 index d7e91490..00000000 --- a/api/internal/handler/vm/deletevolumehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteVolumeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteVolumeReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteVolumeLogic(r.Context(), svcCtx) - resp, err := l.DeleteVolume(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletevolumetypehandler.go b/api/internal/handler/vm/deletevolumetypehandler.go deleted file mode 100644 index 6467de46..00000000 --- a/api/internal/handler/vm/deletevolumetypehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteVolumeTypeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteVolumeTypeReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteVolumeTypeLogic(r.Context(), svcCtx) - resp, err := l.DeleteVolumeType(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/getcomputelimitshandler.go b/api/internal/handler/vm/getcomputelimitshandler.go deleted file mode 100644 index e52d0fb9..00000000 --- a/api/internal/handler/vm/getcomputelimitshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetComputeLimitsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetComputeLimitsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewGetComputeLimitsLogic(r.Context(), svcCtx) - resp, err := l.GetComputeLimits(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/getimagenumhandler.go b/api/internal/handler/vm/getimagenumhandler.go deleted file mode 100644 index ecaf4ea1..00000000 --- a/api/internal/handler/vm/getimagenumhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetImageNumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListImagesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewGetImageNumLogic(r.Context(), svcCtx) - resp, err := l.GetImageNum(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/getnetworknumhandler.go b/api/internal/handler/vm/getnetworknumhandler.go deleted file mode 100644 index d1115cdf..00000000 --- a/api/internal/handler/vm/getnetworknumhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetNetworkNumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListNetworksReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewGetNetworkNumLogic(r.Context(), svcCtx) - resp, err := l.GetNetworkNum(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/getserversdetailedbyidhandler.go b/api/internal/handler/vm/getserversdetailedbyidhandler.go deleted file mode 100644 index 884d5412..00000000 --- a/api/internal/handler/vm/getserversdetailedbyidhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetServersDetailedByIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetServersDetailedByIdReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewGetServersDetailedByIdLogic(r.Context(), svcCtx) - resp, err := l.GetServersDetailedById(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/getvolumedetailedbyidhandler.go b/api/internal/handler/vm/getvolumedetailedbyidhandler.go deleted file mode 100644 index fa08be98..00000000 --- a/api/internal/handler/vm/getvolumedetailedbyidhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetVolumeDetailedByIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetVolumeDetailedByIdReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewGetVolumeDetailedByIdLogic(r.Context(), svcCtx) - resp, err := l.GetVolumeDetailedById(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/getvolumelimitshandler.go b/api/internal/handler/vm/getvolumelimitshandler.go deleted file mode 100644 index 07e9af2d..00000000 --- a/api/internal/handler/vm/getvolumelimitshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetVolumeLimitsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetVolumeLimitsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewGetVolumeLimitsLogic(r.Context(), svcCtx) - resp, err := l.GetVolumeLimits(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listfirewallgroupshandler.go b/api/internal/handler/vm/listfirewallgroupshandler.go deleted file mode 100644 index 01041333..00000000 --- a/api/internal/handler/vm/listfirewallgroupshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListFirewallGroupsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListFirewallGroupsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListFirewallGroupsLogic(r.Context(), svcCtx) - resp, err := l.ListFirewallGroups(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listfirewallpolicieshandler.go b/api/internal/handler/vm/listfirewallpolicieshandler.go deleted file mode 100644 index 877c2806..00000000 --- a/api/internal/handler/vm/listfirewallpolicieshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListFirewallPoliciesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListFirewallPoliciesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListFirewallPoliciesLogic(r.Context(), svcCtx) - resp, err := l.ListFirewallPolicies(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listfirewallruleshandler.go b/api/internal/handler/vm/listfirewallruleshandler.go deleted file mode 100644 index b630593c..00000000 --- a/api/internal/handler/vm/listfirewallruleshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListFirewallRulesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListFirewallRulesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListFirewallRulesLogic(r.Context(), svcCtx) - resp, err := l.ListFirewallRules(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listflavorsdetailhandler.go b/api/internal/handler/vm/listflavorsdetailhandler.go deleted file mode 100644 index 09362f69..00000000 --- a/api/internal/handler/vm/listflavorsdetailhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListFlavorsDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListFlavorsDetailReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListFlavorsDetailLogic(r.Context(), svcCtx) - resp, err := l.ListFlavorsDetail(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listfloatingipshandler.go b/api/internal/handler/vm/listfloatingipshandler.go deleted file mode 100644 index f723634c..00000000 --- a/api/internal/handler/vm/listfloatingipshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListFloatingIPsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListFloatingIPsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListFloatingIPsLogic(r.Context(), svcCtx) - resp, err := l.ListFloatingIPs(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listimageshandler.go b/api/internal/handler/vm/listimageshandler.go deleted file mode 100644 index cf5844cb..00000000 --- a/api/internal/handler/vm/listimageshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListImagesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListImagesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListImagesLogic(r.Context(), svcCtx) - resp, err := l.ListImages(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listnetworksegmentrangesrangehandler.go b/api/internal/handler/vm/listnetworksegmentrangesrangehandler.go deleted file mode 100644 index 27b3478f..00000000 --- a/api/internal/handler/vm/listnetworksegmentrangesrangehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListNetworkSegmentRangesRangeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListNetworkSegmentRangesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListNetworkSegmentRangesRangeLogic(r.Context(), svcCtx) - resp, err := l.ListNetworkSegmentRangesRange(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listnetworkshandler.go b/api/internal/handler/vm/listnetworkshandler.go deleted file mode 100644 index c7078abf..00000000 --- a/api/internal/handler/vm/listnetworkshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListNetworksHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListNetworksReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListNetworksLogic(r.Context(), svcCtx) - resp, err := l.ListNetworks(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listnodeshandler.go b/api/internal/handler/vm/listnodeshandler.go deleted file mode 100644 index fcc192d2..00000000 --- a/api/internal/handler/vm/listnodeshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListNodesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListNodesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListNodesLogic(r.Context(), svcCtx) - resp, err := l.ListNodes(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listportshandler.go b/api/internal/handler/vm/listportshandler.go deleted file mode 100644 index ac134170..00000000 --- a/api/internal/handler/vm/listportshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListPortsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListPortsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListPortsLogic(r.Context(), svcCtx) - resp, err := l.ListPorts(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listroutershandler.go b/api/internal/handler/vm/listroutershandler.go deleted file mode 100644 index e7b6bc11..00000000 --- a/api/internal/handler/vm/listroutershandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListRoutersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListRoutersReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListRoutersLogic(r.Context(), svcCtx) - resp, err := l.ListRouters(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listsecuritygroupruleshandler.go b/api/internal/handler/vm/listsecuritygroupruleshandler.go deleted file mode 100644 index 2b31f7e8..00000000 --- a/api/internal/handler/vm/listsecuritygroupruleshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListSecurityGroupRulesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListSecurityGroupRulesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListSecurityGroupRulesLogic(r.Context(), svcCtx) - resp, err := l.ListSecurityGroupRules(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listsecuritygroupshandler.go b/api/internal/handler/vm/listsecuritygroupshandler.go deleted file mode 100644 index be559d8d..00000000 --- a/api/internal/handler/vm/listsecuritygroupshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListSecurityGroupsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListSecurityGroupsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListSecurityGroupsLogic(r.Context(), svcCtx) - resp, err := l.ListSecurityGroups(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listserverhandler.go b/api/internal/handler/vm/listserverhandler.go deleted file mode 100644 index 4c859136..00000000 --- a/api/internal/handler/vm/listserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListServersReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListServerLogic(r.Context(), svcCtx) - resp, err := l.ListServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listserversdetailedhandler.go b/api/internal/handler/vm/listserversdetailedhandler.go deleted file mode 100644 index 1dc3daaf..00000000 --- a/api/internal/handler/vm/listserversdetailedhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListServersDetailedHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListServersDetailedReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListServersDetailedLogic(r.Context(), svcCtx) - resp, err := l.ListServersDetailed(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listsubnetshandler.go b/api/internal/handler/vm/listsubnetshandler.go deleted file mode 100644 index a148ccc5..00000000 --- a/api/internal/handler/vm/listsubnetshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListSubnetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListSubnetsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListSubnetsLogic(r.Context(), svcCtx) - resp, err := l.ListSubnets(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listvolumesdetailhandler.go b/api/internal/handler/vm/listvolumesdetailhandler.go deleted file mode 100644 index fd0e6bb2..00000000 --- a/api/internal/handler/vm/listvolumesdetailhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListVolumesDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListVolumesDetailReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListVolumesDetailLogic(r.Context(), svcCtx) - resp, err := l.ListVolumesDetail(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listvolumeshandler.go b/api/internal/handler/vm/listvolumeshandler.go deleted file mode 100644 index 330fc958..00000000 --- a/api/internal/handler/vm/listvolumeshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListVolumesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListVolumesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListVolumesLogic(r.Context(), svcCtx) - resp, err := l.ListVolumes(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listvolumetypeshandler.go b/api/internal/handler/vm/listvolumetypeshandler.go deleted file mode 100644 index 711a2f75..00000000 --- a/api/internal/handler/vm/listvolumetypeshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListVolumeTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListVolumeTypesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListVolumeTypesLogic(r.Context(), svcCtx) - resp, err := l.ListVolumeTypes(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/migrateserverhandler.go b/api/internal/handler/vm/migrateserverhandler.go deleted file mode 100644 index 2a7dbe82..00000000 --- a/api/internal/handler/vm/migrateserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func MigrateServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.MigrateServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewMigrateServerLogic(r.Context(), svcCtx) - resp, err := l.MigrateServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/pauseserverhandler.go b/api/internal/handler/vm/pauseserverhandler.go deleted file mode 100644 index 610c4193..00000000 --- a/api/internal/handler/vm/pauseserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func PauseServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.PauseServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewPauseServerLogic(r.Context(), svcCtx) - resp, err := l.PauseServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/rebootserverhandler.go b/api/internal/handler/vm/rebootserverhandler.go deleted file mode 100644 index 31da26be..00000000 --- a/api/internal/handler/vm/rebootserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func RebootServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.RebootServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewRebootServerLogic(r.Context(), svcCtx) - resp, err := l.RebootServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/removesecuritygrouphandler.go b/api/internal/handler/vm/removesecuritygrouphandler.go deleted file mode 100644 index 40b21349..00000000 --- a/api/internal/handler/vm/removesecuritygrouphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func RemoveSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.RemoveSecurityGroupReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewRemoveSecurityGroupLogic(r.Context(), svcCtx) - resp, err := l.RemoveSecurityGroup(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/rescueserverhandler.go b/api/internal/handler/vm/rescueserverhandler.go deleted file mode 100644 index 97c18bd2..00000000 --- a/api/internal/handler/vm/rescueserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func RescueServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.RescueServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewRescueServerLogic(r.Context(), svcCtx) - resp, err := l.RescueServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/resizeserverhandler.go b/api/internal/handler/vm/resizeserverhandler.go deleted file mode 100644 index 81d8be1e..00000000 --- a/api/internal/handler/vm/resizeserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ResizeServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ResizeServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewResizeServerLogic(r.Context(), svcCtx) - resp, err := l.ResizeServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/shelveserverhandler.go b/api/internal/handler/vm/shelveserverhandler.go deleted file mode 100644 index 927c78c3..00000000 --- a/api/internal/handler/vm/shelveserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShelveServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShelveServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShelveServerLogic(r.Context(), svcCtx) - resp, err := l.ShelveServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/showfirewallgroupdetailshandler.go b/api/internal/handler/vm/showfirewallgroupdetailshandler.go deleted file mode 100644 index 6e1e07ae..00000000 --- a/api/internal/handler/vm/showfirewallgroupdetailshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowFirewallGroupDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowFirewallGroupDetailsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowFirewallGroupDetailsLogic(r.Context(), svcCtx) - resp, err := l.ShowFirewallGroupDetails(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/showfirewallpolicydetailshandler.go b/api/internal/handler/vm/showfirewallpolicydetailshandler.go deleted file mode 100644 index 1b562893..00000000 --- a/api/internal/handler/vm/showfirewallpolicydetailshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowFirewallPolicyDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowFirewallPolicyDetailsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowFirewallPolicyDetailsLogic(r.Context(), svcCtx) - resp, err := l.ShowFirewallPolicyDetails(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/showfirewallruledetailshandler.go b/api/internal/handler/vm/showfirewallruledetailshandler.go deleted file mode 100644 index b026c434..00000000 --- a/api/internal/handler/vm/showfirewallruledetailshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowFirewallRuleDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowFirewallRuleDetailsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowFirewallRuleDetailsLogic(r.Context(), svcCtx) - resp, err := l.ShowFirewallRuleDetails(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/showfloatingipdetailshandler.go b/api/internal/handler/vm/showfloatingipdetailshandler.go deleted file mode 100644 index 91e09a44..00000000 --- a/api/internal/handler/vm/showfloatingipdetailshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowFloatingIPDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowFloatingIPDetailsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowFloatingIPDetailsLogic(r.Context(), svcCtx) - resp, err := l.ShowFloatingIPDetails(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/shownetworkdetailshandler.go b/api/internal/handler/vm/shownetworkdetailshandler.go deleted file mode 100644 index 113a0e7e..00000000 --- a/api/internal/handler/vm/shownetworkdetailshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowNetworkDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowNetworkDetailsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowNetworkDetailsLogic(r.Context(), svcCtx) - resp, err := l.ShowNetworkDetails(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/shownetworksegmentrangedetailshandler.go b/api/internal/handler/vm/shownetworksegmentrangedetailshandler.go deleted file mode 100644 index 309c7533..00000000 --- a/api/internal/handler/vm/shownetworksegmentrangedetailshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowNetworkSegmentRangeDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowNetworkSegmentRangeDetailsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowNetworkSegmentRangeDetailsLogic(r.Context(), svcCtx) - resp, err := l.ShowNetworkSegmentRangeDetails(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/shownodedetailshandler.go b/api/internal/handler/vm/shownodedetailshandler.go deleted file mode 100644 index 1a025f73..00000000 --- a/api/internal/handler/vm/shownodedetailshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowNodeDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowNodeDetailsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowNodeDetailsLogic(r.Context(), svcCtx) - resp, err := l.ShowNodeDetails(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/showportdetailshandler.go b/api/internal/handler/vm/showportdetailshandler.go deleted file mode 100644 index 2066679e..00000000 --- a/api/internal/handler/vm/showportdetailshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowPortDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowPortDetailsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowPortDetailsLogic(r.Context(), svcCtx) - resp, err := l.ShowPortDetails(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/showrouterdetailshandler.go b/api/internal/handler/vm/showrouterdetailshandler.go deleted file mode 100644 index 395e03d2..00000000 --- a/api/internal/handler/vm/showrouterdetailshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowRouterDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowRouterDetailsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowRouterDetailsLogic(r.Context(), svcCtx) - resp, err := l.ShowRouterDetails(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/showsecuritygrouphandler.go b/api/internal/handler/vm/showsecuritygrouphandler.go deleted file mode 100644 index 0cf2ecfa..00000000 --- a/api/internal/handler/vm/showsecuritygrouphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowSecurityGroupReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowSecurityGroupLogic(r.Context(), svcCtx) - resp, err := l.ShowSecurityGroup(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/showsecuritygrouprulehandler.go b/api/internal/handler/vm/showsecuritygrouprulehandler.go deleted file mode 100644 index 3dcdc0ed..00000000 --- a/api/internal/handler/vm/showsecuritygrouprulehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowSecurityGroupRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowSecurityGroupRuleReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowSecurityGroupRuleLogic(r.Context(), svcCtx) - resp, err := l.ShowSecurityGroupRule(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/startserverhandler.go b/api/internal/handler/vm/startserverhandler.go deleted file mode 100644 index 00fc4257..00000000 --- a/api/internal/handler/vm/startserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func StartServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.StartServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewStartServerLogic(r.Context(), svcCtx) - resp, err := l.StartServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/stopserverhandler.go b/api/internal/handler/vm/stopserverhandler.go deleted file mode 100644 index 1941ade0..00000000 --- a/api/internal/handler/vm/stopserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func StopServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.StopServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewStopServerLogic(r.Context(), svcCtx) - resp, err := l.StopServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/suspendserverhandler.go b/api/internal/handler/vm/suspendserverhandler.go deleted file mode 100644 index fd9826e8..00000000 --- a/api/internal/handler/vm/suspendserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func SuspendServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.SuspendServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewSuspendServerLogic(r.Context(), svcCtx) - resp, err := l.SuspendServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/unpauseserverhandler.go b/api/internal/handler/vm/unpauseserverhandler.go deleted file mode 100644 index 3095d1e8..00000000 --- a/api/internal/handler/vm/unpauseserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UnpauseServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UnpauseServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUnpauseServerLogic(r.Context(), svcCtx) - resp, err := l.UnpauseServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/unrescuehandler.go b/api/internal/handler/vm/unrescuehandler.go deleted file mode 100644 index e07adec8..00000000 --- a/api/internal/handler/vm/unrescuehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UnRescueHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UnRescueServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUnRescueLogic(r.Context(), svcCtx) - resp, err := l.UnRescue(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updatefirewallgrouphandler.go b/api/internal/handler/vm/updatefirewallgrouphandler.go deleted file mode 100644 index 1d072d0b..00000000 --- a/api/internal/handler/vm/updatefirewallgrouphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateFirewallGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateFirewallGroupReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdateFirewallGroupLogic(r.Context(), svcCtx) - resp, err := l.UpdateFirewallGroup(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updatefloatingiphandler.go b/api/internal/handler/vm/updatefloatingiphandler.go deleted file mode 100644 index 16493a84..00000000 --- a/api/internal/handler/vm/updatefloatingiphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateFloatingIPHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateFloatingIPReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdateFloatingIPLogic(r.Context(), svcCtx) - resp, err := l.UpdateFloatingIP(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updatenetworkhandler.go b/api/internal/handler/vm/updatenetworkhandler.go deleted file mode 100644 index fc1b3a0c..00000000 --- a/api/internal/handler/vm/updatenetworkhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateNetworkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateNetworkReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdateNetworkLogic(r.Context(), svcCtx) - resp, err := l.UpdateNetwork(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updatenetworksegmentrangeshandler.go b/api/internal/handler/vm/updatenetworksegmentrangeshandler.go deleted file mode 100644 index c91e38eb..00000000 --- a/api/internal/handler/vm/updatenetworksegmentrangeshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateNetworkSegmentRangesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateNetworkSegmentRangesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdateNetworkSegmentRangesLogic(r.Context(), svcCtx) - resp, err := l.UpdateNetworkSegmentRanges(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updateporthandler.go b/api/internal/handler/vm/updateporthandler.go deleted file mode 100644 index 37e34376..00000000 --- a/api/internal/handler/vm/updateporthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdatePortHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdatePortReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdatePortLogic(r.Context(), svcCtx) - resp, err := l.UpdatePort(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updaterouterhandler.go b/api/internal/handler/vm/updaterouterhandler.go deleted file mode 100644 index 262ee32a..00000000 --- a/api/internal/handler/vm/updaterouterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateRouterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateRouterReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdateRouterLogic(r.Context(), svcCtx) - resp, err := l.UpdateRouter(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updatesecuritygrouphandler.go b/api/internal/handler/vm/updatesecuritygrouphandler.go deleted file mode 100644 index 2d0d5de2..00000000 --- a/api/internal/handler/vm/updatesecuritygrouphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateSecurityGroupReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdateSecurityGroupLogic(r.Context(), svcCtx) - resp, err := l.UpdateSecurityGroup(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updateserverhandler.go b/api/internal/handler/vm/updateserverhandler.go deleted file mode 100644 index acd162a4..00000000 --- a/api/internal/handler/vm/updateserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdateServerLogic(r.Context(), svcCtx) - resp, err := l.UpdateServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updatesubnethandler.go b/api/internal/handler/vm/updatesubnethandler.go deleted file mode 100644 index a8093754..00000000 --- a/api/internal/handler/vm/updatesubnethandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateSubnetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateSubnetReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdateSubnetLogic(r.Context(), svcCtx) - resp, err := l.UpdateSubnet(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updatevolumehandler.go b/api/internal/handler/vm/updatevolumehandler.go deleted file mode 100644 index 80389014..00000000 --- a/api/internal/handler/vm/updatevolumehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateVolumeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateVolumeReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdateVolumeLogic(r.Context(), svcCtx) - resp, err := l.UpdateVolume(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/uploadimagehandler.go b/api/internal/handler/vm/uploadimagehandler.go deleted file mode 100644 index 0682d12f..00000000 --- a/api/internal/handler/vm/uploadimagehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UploadImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UploadOsImageReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUploadImageLogic(r.Context(), svcCtx) - resp, err := l.UploadImage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/types/types.go b/api/internal/types/types.go index ccc11455..aeb3d62d 100644 --- a/api/internal/types/types.go +++ b/api/internal/types/types.go @@ -869,10 +869,13 @@ type CommitHpcTaskReq struct { StdErrFile string `json:"stdErrFile,optional"` StdInput string `json:"stdInput,optional"` Environment map[string]string `json:"environment,optional"` + ClusterType string `json:"clusterType,optional"` } type CommitHpcTaskResp struct { - TaskId int64 `json:"taskId"` + TaskId int64 `json:"taskId"` + Code int32 `json:"code"` + Msg string `json:"msg"` } type ListJobReq struct { @@ -2885,7 +2888,7 @@ type Server struct { ImageRef string `json:"imageRef,optional" copier:"ImageRef"` Networks []CreNetwork `json:"networks,optional" copier:"Networks"` BlockDeviceMappingV2 []Block_device_mapping_v2 `json:"block_device_mapping_v2,optional" copier:"BlockDeviceMappingV2"` - MinCount string `json:"min_count,optional" copier:"MinCount"` + MinCount int32 `json:"min_count,optional" copier:"MinCount"` } type CreNetwork struct { From 9c1e7b31e0567d4fa8518de9d48be07cfa161965 Mon Sep 17 00:00:00 2001 From: qiwang <1364512070@qq.com> Date: Mon, 25 Mar 2024 19:41:58 +0800 Subject: [PATCH 3/4] fix:Modify configuration file fields Former-commit-id: 14e2d76333ba307db94037a3814193be538b6590 --- .../handler/adapters/adapterslisthandler.go | 28 + .../handler/adapters/clusterlisthandler.go | 28 + .../handler/adapters/createadapterhandler.go | 28 + .../handler/adapters/createclusterhandler.go | 28 + .../handler/adapters/deleteadapterhandler.go | 28 + .../handler/adapters/deleteclusterhandler.go | 28 + .../handler/adapters/getadapterhandler.go | 28 + .../adapters/getadapterrelationhandler.go | 28 + .../handler/adapters/getclusterhandler.go | 28 + .../handler/adapters/getclustersumhandler.go | 28 + .../handler/adapters/updateadapterhandler.go | 28 + .../handler/adapters/updateclusterhandler.go | 28 + .../handler/ai/createalgorithmhandler.go | 28 + .../handler/ai/createdatasethandler.go | 28 + .../handler/ai/createexporttaskhandler.go | 28 + .../handler/ai/createnotebookhandler.go | 28 + .../handler/ai/createprocessortaskhandler.go | 28 + .../handler/ai/createservicehandler.go | 28 + api/internal/handler/ai/createtaskhandler.go | 28 + .../handler/ai/createtrainingjobhandler.go | 28 + .../ai/createvisualizationjobhandler.go | 28 + .../handler/ai/deletealgorithmhandler.go | 28 + .../handler/ai/deletedatasethandler.go | 28 + .../handler/ai/deleteservicehandler.go | 28 + .../handler/ai/deletetrainingjobhandler.go | 28 + .../ai/getexporttasksofdatasethandler.go | 28 + .../ai/getexporttaskstatusofdatasethandler.go | 28 + .../handler/ai/getlisttrainingjobshandler.go | 28 + .../handler/ai/getnotebookstoragehandler.go | 28 + .../handler/ai/getvisualizationjobhandler.go | 28 + .../handler/ai/listalgorithmshandler.go | 28 + .../handler/ai/listclustershandler.go | 28 + api/internal/handler/ai/listdatasethandler.go | 28 + api/internal/handler/ai/listimporthandler.go | 28 + .../handler/ai/listnotebookhandler.go | 28 + .../handler/ai/listserviceshandler.go | 28 + .../handler/ai/mountnotebookstoragehandler.go | 28 + .../handler/ai/showalgorithmbyuuidhandler.go | 28 + api/internal/handler/ai/showservicehandler.go | 28 + .../handler/ai/startnotebookhandler.go | 28 + .../handler/ai/stopnotebookhandler.go | 28 + api/internal/handler/apps/appdetailhandler.go | 28 + api/internal/handler/apps/applisthandler.go | 28 + api/internal/handler/apps/apppodshandler.go | 28 + .../handler/apps/deleteappbyappnamehandler.go | 28 + .../handler/apps/getappbyappnamehandler.go | 28 + .../handler/apps/pauseappbyappnamehandler.go | 28 + .../apps/restartappbyappnamehandler.go | 28 + .../handler/apps/startappbyappnamehandler.go | 28 + .../handler/apps/updateappbyappnamehandler.go | 28 + .../handler/cloud/cloudlisthandler.go | 21 + .../handler/cloud/controllermetricshandler.go | 28 + .../handler/cloud/deleteclusterhandler.go | 28 + .../handler/cloud/deleteyamlhandler.go | 28 + .../handler/cloud/getclusterlisthandler.go | 28 + .../handler/cloud/noticetenanthandler.go | 21 + .../handler/cloud/registerclusterhandler.go | 28 + .../handler/cloud/updatetenanthandler.go | 28 + .../handler/core/centerresourceshandler.go | 21 + .../handler/core/committaskhandler.go | 28 + .../handler/core/commitvmtaskhandler.go | 28 + .../handler/core/deletetaskhandler.go | 28 + .../core/getcomputilitystatisticshandler.go | 21 + .../handler/core/getcomputingpowerhandler.go | 21 + .../handler/core/getgeneralinfohandler.go | 21 + api/internal/handler/core/getregionhandler.go | 21 + .../core/getresourcepanelconfighandler.go | 21 + api/internal/handler/core/jobtotalhandler.go | 21 + .../handler/core/listcenterhandler.go | 21 + .../handler/core/listclusterhandler.go | 28 + .../handler/core/listdomainresourcehandler.go | 21 + .../handler/core/listregionhandler.go | 21 + api/internal/handler/core/metricshandler.go | 21 + .../handler/core/nodeassetshandler.go | 21 + .../handler/core/participantlisthandler.go | 21 + .../handler/core/pulltaskinfohandler.go | 28 + .../handler/core/pushtaskinfohandler.go | 28 + .../core/putresourcepanelconfighandler.go | 28 + .../handler/core/scheduletaskbyyamlhandler.go | 28 + .../handler/core/syncclusterloadhandler.go | 28 + .../handler/core/taskdetailhandler.go | 28 + api/internal/handler/core/tasklisthandler.go | 28 + .../handler/dictionary/adddicthandler.go | 28 + .../handler/dictionary/adddictitemhandler.go | 28 + .../handler/dictionary/deletedicthandler.go | 28 + .../dictionary/deletedictitemhandler.go | 28 + .../handler/dictionary/editdicthandler.go | 28 + .../handler/dictionary/editdictitemhandler.go | 28 + .../handler/dictionary/getdicthandler.go | 28 + .../handler/dictionary/getdictitemhandler.go | 28 + .../handler/dictionary/listdicthandler.go | 28 + .../dictionary/listdictitembycodehandler.go | 28 + .../handler/dictionary/listdictitemhandler.go | 28 + .../handler/hpc/commithpctaskhandler.go | 28 + .../handler/hpc/listhistoryjobhandler.go | 28 + api/internal/handler/hpc/listjobhandler.go | 28 + .../handler/hpc/queueassetshandler.go | 21 + api/internal/handler/image/chunkhandler.go | 21 + .../handler/image/datasetcheckhandler.go | 28 + .../handler/image/imagelisthandler.go | 21 + .../handler/image/uploaddatasethandler.go | 21 + api/internal/handler/image/uploadhandler.go | 21 + api/internal/handler/routes.go | 1166 +++++++++++++++++ .../schedulegetairesourcetypeshandler.go | 21 + .../schedule/schedulegetaitasktypeshandler.go | 21 + .../schedule/schedulegetdatasetshandler.go | 21 + .../schedule/schedulegetstrategyhandler.go | 21 + .../handler/schedule/schedulesubmithandler.go | 28 + .../storage/dailypowerscreenhandler.go | 28 + .../storage/percentercomputerpowershandler.go | 28 + .../handler/storage/screenstoragehandler.go | 28 + .../storelink/deletelinkimagehandler.go | 28 + .../storelink/deletelinktaskhandler.go | 28 + .../handler/storelink/getaispecshandler.go | 28 + .../storelink/getlinkimagelisthandler.go | 28 + .../handler/storelink/getlinktaskhandler.go | 28 + .../storelink/getparticipantshandler.go | 28 + .../storelink/submitlinktaskhandler.go | 28 + .../storelink/uploadlinkimagehandler.go | 28 + .../vm/addsecuritygrouptoserverhandler.go | 28 + .../handler/vm/bulkcreatenetworkshandler.go | 28 + .../vm/changeadministrativepasswordhandler.go | 28 + .../handler/vm/createfirewallgrouphandler.go | 28 + .../handler/vm/createfirewallpolicyhandler.go | 28 + .../handler/vm/createfirewallrulehandler.go | 28 + .../handler/vm/createflavorhandler.go | 28 + .../handler/vm/createfloatingiphandler.go | 28 + api/internal/handler/vm/createimagehandler.go | 28 + .../handler/vm/createnetworkhandler.go | 28 + .../vm/createnetworksegmentrangehandler.go | 28 + api/internal/handler/vm/createnodehandler.go | 28 + api/internal/handler/vm/createporthandler.go | 28 + .../handler/vm/createrouterhandler.go | 28 + .../handler/vm/createsecuritygrouphandler.go | 28 + .../vm/createsecuritygrouprulehandler.go | 28 + .../handler/vm/createserverhandler.go | 28 + .../handler/vm/createsubnethandler.go | 28 + .../handler/vm/createvolumehandler.go | 28 + .../handler/vm/createvolumetypeshandler.go | 28 + .../handler/vm/deletefirewallgrouphandler.go | 28 + .../handler/vm/deletefirewallpolicyhandler.go | 28 + .../handler/vm/deletefirewallrulehandler.go | 28 + .../handler/vm/deleteflavorhandler.go | 28 + .../handler/vm/deletefloatingiphandler.go | 28 + api/internal/handler/vm/deleteimagehandler.go | 28 + .../handler/vm/deletenetworkhandler.go | 28 + .../vm/deletenetworksegmentrangeshandler.go | 28 + api/internal/handler/vm/deletenodehandler.go | 28 + api/internal/handler/vm/deleteporthandler.go | 28 + .../handler/vm/deleterouterhandler.go | 28 + .../handler/vm/deletesecuritygrouphandler.go | 28 + .../vm/deletesecuritygrouprulehandler.go | 28 + .../handler/vm/deleteserverhandler.go | 28 + .../handler/vm/deletesubnethandler.go | 28 + .../handler/vm/deletevolumehandler.go | 28 + .../handler/vm/deletevolumetypehandler.go | 28 + .../handler/vm/getcomputelimitshandler.go | 28 + api/internal/handler/vm/getimagenumhandler.go | 28 + .../handler/vm/getnetworknumhandler.go | 28 + .../vm/getserversdetailedbyidhandler.go | 28 + .../vm/getvolumedetailedbyidhandler.go | 28 + .../handler/vm/getvolumelimitshandler.go | 28 + .../handler/vm/listfirewallgroupshandler.go | 28 + .../handler/vm/listfirewallpolicieshandler.go | 28 + .../handler/vm/listfirewallruleshandler.go | 28 + .../handler/vm/listflavorsdetailhandler.go | 28 + .../handler/vm/listfloatingipshandler.go | 28 + api/internal/handler/vm/listimageshandler.go | 28 + .../listnetworksegmentrangesrangehandler.go | 28 + .../handler/vm/listnetworkshandler.go | 28 + api/internal/handler/vm/listnodeshandler.go | 28 + api/internal/handler/vm/listportshandler.go | 28 + api/internal/handler/vm/listroutershandler.go | 28 + .../vm/listsecuritygroupruleshandler.go | 28 + .../handler/vm/listsecuritygroupshandler.go | 28 + api/internal/handler/vm/listserverhandler.go | 28 + .../handler/vm/listserversdetailedhandler.go | 28 + api/internal/handler/vm/listsubnetshandler.go | 28 + .../handler/vm/listvolumesdetailhandler.go | 28 + api/internal/handler/vm/listvolumeshandler.go | 28 + .../handler/vm/listvolumetypeshandler.go | 28 + .../handler/vm/migrateserverhandler.go | 28 + api/internal/handler/vm/pauseserverhandler.go | 28 + .../handler/vm/rebootserverhandler.go | 28 + .../handler/vm/removesecuritygrouphandler.go | 28 + .../handler/vm/rescueserverhandler.go | 28 + .../handler/vm/resizeserverhandler.go | 28 + .../handler/vm/shelveserverhandler.go | 28 + .../vm/showfirewallgroupdetailshandler.go | 28 + .../vm/showfirewallpolicydetailshandler.go | 28 + .../vm/showfirewallruledetailshandler.go | 28 + .../vm/showfloatingipdetailshandler.go | 28 + .../handler/vm/shownetworkdetailshandler.go | 28 + .../shownetworksegmentrangedetailshandler.go | 28 + .../handler/vm/shownodedetailshandler.go | 28 + .../handler/vm/showportdetailshandler.go | 28 + .../handler/vm/showrouterdetailshandler.go | 28 + .../handler/vm/showsecuritygrouphandler.go | 28 + .../vm/showsecuritygrouprulehandler.go | 28 + api/internal/handler/vm/startserverhandler.go | 28 + api/internal/handler/vm/stopserverhandler.go | 28 + .../handler/vm/suspendserverhandler.go | 28 + .../handler/vm/unpauseserverhandler.go | 28 + api/internal/handler/vm/unrescuehandler.go | 28 + .../handler/vm/updatefirewallgrouphandler.go | 28 + .../handler/vm/updatefloatingiphandler.go | 28 + .../handler/vm/updatenetworkhandler.go | 28 + .../vm/updatenetworksegmentrangeshandler.go | 28 + api/internal/handler/vm/updateporthandler.go | 28 + .../handler/vm/updaterouterhandler.go | 28 + .../handler/vm/updatesecuritygrouphandler.go | 28 + .../handler/vm/updateserverhandler.go | 28 + .../handler/vm/updatesubnethandler.go | 28 + .../handler/vm/updatevolumehandler.go | 28 + api/internal/handler/vm/uploadimagehandler.go | 28 + 215 files changed, 6990 insertions(+) create mode 100644 api/internal/handler/adapters/adapterslisthandler.go create mode 100644 api/internal/handler/adapters/clusterlisthandler.go create mode 100644 api/internal/handler/adapters/createadapterhandler.go create mode 100644 api/internal/handler/adapters/createclusterhandler.go create mode 100644 api/internal/handler/adapters/deleteadapterhandler.go create mode 100644 api/internal/handler/adapters/deleteclusterhandler.go create mode 100644 api/internal/handler/adapters/getadapterhandler.go create mode 100644 api/internal/handler/adapters/getadapterrelationhandler.go create mode 100644 api/internal/handler/adapters/getclusterhandler.go create mode 100644 api/internal/handler/adapters/getclustersumhandler.go create mode 100644 api/internal/handler/adapters/updateadapterhandler.go create mode 100644 api/internal/handler/adapters/updateclusterhandler.go create mode 100644 api/internal/handler/ai/createalgorithmhandler.go create mode 100644 api/internal/handler/ai/createdatasethandler.go create mode 100644 api/internal/handler/ai/createexporttaskhandler.go create mode 100644 api/internal/handler/ai/createnotebookhandler.go create mode 100644 api/internal/handler/ai/createprocessortaskhandler.go create mode 100644 api/internal/handler/ai/createservicehandler.go create mode 100644 api/internal/handler/ai/createtaskhandler.go create mode 100644 api/internal/handler/ai/createtrainingjobhandler.go create mode 100644 api/internal/handler/ai/createvisualizationjobhandler.go create mode 100644 api/internal/handler/ai/deletealgorithmhandler.go create mode 100644 api/internal/handler/ai/deletedatasethandler.go create mode 100644 api/internal/handler/ai/deleteservicehandler.go create mode 100644 api/internal/handler/ai/deletetrainingjobhandler.go create mode 100644 api/internal/handler/ai/getexporttasksofdatasethandler.go create mode 100644 api/internal/handler/ai/getexporttaskstatusofdatasethandler.go create mode 100644 api/internal/handler/ai/getlisttrainingjobshandler.go create mode 100644 api/internal/handler/ai/getnotebookstoragehandler.go create mode 100644 api/internal/handler/ai/getvisualizationjobhandler.go create mode 100644 api/internal/handler/ai/listalgorithmshandler.go create mode 100644 api/internal/handler/ai/listclustershandler.go create mode 100644 api/internal/handler/ai/listdatasethandler.go create mode 100644 api/internal/handler/ai/listimporthandler.go create mode 100644 api/internal/handler/ai/listnotebookhandler.go create mode 100644 api/internal/handler/ai/listserviceshandler.go create mode 100644 api/internal/handler/ai/mountnotebookstoragehandler.go create mode 100644 api/internal/handler/ai/showalgorithmbyuuidhandler.go create mode 100644 api/internal/handler/ai/showservicehandler.go create mode 100644 api/internal/handler/ai/startnotebookhandler.go create mode 100644 api/internal/handler/ai/stopnotebookhandler.go create mode 100644 api/internal/handler/apps/appdetailhandler.go create mode 100644 api/internal/handler/apps/applisthandler.go create mode 100644 api/internal/handler/apps/apppodshandler.go create mode 100644 api/internal/handler/apps/deleteappbyappnamehandler.go create mode 100644 api/internal/handler/apps/getappbyappnamehandler.go create mode 100644 api/internal/handler/apps/pauseappbyappnamehandler.go create mode 100644 api/internal/handler/apps/restartappbyappnamehandler.go create mode 100644 api/internal/handler/apps/startappbyappnamehandler.go create mode 100644 api/internal/handler/apps/updateappbyappnamehandler.go create mode 100644 api/internal/handler/cloud/cloudlisthandler.go create mode 100644 api/internal/handler/cloud/controllermetricshandler.go create mode 100644 api/internal/handler/cloud/deleteclusterhandler.go create mode 100644 api/internal/handler/cloud/deleteyamlhandler.go create mode 100644 api/internal/handler/cloud/getclusterlisthandler.go create mode 100644 api/internal/handler/cloud/noticetenanthandler.go create mode 100644 api/internal/handler/cloud/registerclusterhandler.go create mode 100644 api/internal/handler/cloud/updatetenanthandler.go create mode 100644 api/internal/handler/core/centerresourceshandler.go create mode 100644 api/internal/handler/core/committaskhandler.go create mode 100644 api/internal/handler/core/commitvmtaskhandler.go create mode 100644 api/internal/handler/core/deletetaskhandler.go create mode 100644 api/internal/handler/core/getcomputilitystatisticshandler.go create mode 100644 api/internal/handler/core/getcomputingpowerhandler.go create mode 100644 api/internal/handler/core/getgeneralinfohandler.go create mode 100644 api/internal/handler/core/getregionhandler.go create mode 100644 api/internal/handler/core/getresourcepanelconfighandler.go create mode 100644 api/internal/handler/core/jobtotalhandler.go create mode 100644 api/internal/handler/core/listcenterhandler.go create mode 100644 api/internal/handler/core/listclusterhandler.go create mode 100644 api/internal/handler/core/listdomainresourcehandler.go create mode 100644 api/internal/handler/core/listregionhandler.go create mode 100644 api/internal/handler/core/metricshandler.go create mode 100644 api/internal/handler/core/nodeassetshandler.go create mode 100644 api/internal/handler/core/participantlisthandler.go create mode 100644 api/internal/handler/core/pulltaskinfohandler.go create mode 100644 api/internal/handler/core/pushtaskinfohandler.go create mode 100644 api/internal/handler/core/putresourcepanelconfighandler.go create mode 100644 api/internal/handler/core/scheduletaskbyyamlhandler.go create mode 100644 api/internal/handler/core/syncclusterloadhandler.go create mode 100644 api/internal/handler/core/taskdetailhandler.go create mode 100644 api/internal/handler/core/tasklisthandler.go create mode 100644 api/internal/handler/dictionary/adddicthandler.go create mode 100644 api/internal/handler/dictionary/adddictitemhandler.go create mode 100644 api/internal/handler/dictionary/deletedicthandler.go create mode 100644 api/internal/handler/dictionary/deletedictitemhandler.go create mode 100644 api/internal/handler/dictionary/editdicthandler.go create mode 100644 api/internal/handler/dictionary/editdictitemhandler.go create mode 100644 api/internal/handler/dictionary/getdicthandler.go create mode 100644 api/internal/handler/dictionary/getdictitemhandler.go create mode 100644 api/internal/handler/dictionary/listdicthandler.go create mode 100644 api/internal/handler/dictionary/listdictitembycodehandler.go create mode 100644 api/internal/handler/dictionary/listdictitemhandler.go create mode 100644 api/internal/handler/hpc/commithpctaskhandler.go create mode 100644 api/internal/handler/hpc/listhistoryjobhandler.go create mode 100644 api/internal/handler/hpc/listjobhandler.go create mode 100644 api/internal/handler/hpc/queueassetshandler.go create mode 100644 api/internal/handler/image/chunkhandler.go create mode 100644 api/internal/handler/image/datasetcheckhandler.go create mode 100644 api/internal/handler/image/imagelisthandler.go create mode 100644 api/internal/handler/image/uploaddatasethandler.go create mode 100644 api/internal/handler/image/uploadhandler.go create mode 100644 api/internal/handler/routes.go create mode 100644 api/internal/handler/schedule/schedulegetairesourcetypeshandler.go create mode 100644 api/internal/handler/schedule/schedulegetaitasktypeshandler.go create mode 100644 api/internal/handler/schedule/schedulegetdatasetshandler.go create mode 100644 api/internal/handler/schedule/schedulegetstrategyhandler.go create mode 100644 api/internal/handler/schedule/schedulesubmithandler.go create mode 100644 api/internal/handler/storage/dailypowerscreenhandler.go create mode 100644 api/internal/handler/storage/percentercomputerpowershandler.go create mode 100644 api/internal/handler/storage/screenstoragehandler.go create mode 100644 api/internal/handler/storelink/deletelinkimagehandler.go create mode 100644 api/internal/handler/storelink/deletelinktaskhandler.go create mode 100644 api/internal/handler/storelink/getaispecshandler.go create mode 100644 api/internal/handler/storelink/getlinkimagelisthandler.go create mode 100644 api/internal/handler/storelink/getlinktaskhandler.go create mode 100644 api/internal/handler/storelink/getparticipantshandler.go create mode 100644 api/internal/handler/storelink/submitlinktaskhandler.go create mode 100644 api/internal/handler/storelink/uploadlinkimagehandler.go create mode 100644 api/internal/handler/vm/addsecuritygrouptoserverhandler.go create mode 100644 api/internal/handler/vm/bulkcreatenetworkshandler.go create mode 100644 api/internal/handler/vm/changeadministrativepasswordhandler.go create mode 100644 api/internal/handler/vm/createfirewallgrouphandler.go create mode 100644 api/internal/handler/vm/createfirewallpolicyhandler.go create mode 100644 api/internal/handler/vm/createfirewallrulehandler.go create mode 100644 api/internal/handler/vm/createflavorhandler.go create mode 100644 api/internal/handler/vm/createfloatingiphandler.go create mode 100644 api/internal/handler/vm/createimagehandler.go create mode 100644 api/internal/handler/vm/createnetworkhandler.go create mode 100644 api/internal/handler/vm/createnetworksegmentrangehandler.go create mode 100644 api/internal/handler/vm/createnodehandler.go create mode 100644 api/internal/handler/vm/createporthandler.go create mode 100644 api/internal/handler/vm/createrouterhandler.go create mode 100644 api/internal/handler/vm/createsecuritygrouphandler.go create mode 100644 api/internal/handler/vm/createsecuritygrouprulehandler.go create mode 100644 api/internal/handler/vm/createserverhandler.go create mode 100644 api/internal/handler/vm/createsubnethandler.go create mode 100644 api/internal/handler/vm/createvolumehandler.go create mode 100644 api/internal/handler/vm/createvolumetypeshandler.go create mode 100644 api/internal/handler/vm/deletefirewallgrouphandler.go create mode 100644 api/internal/handler/vm/deletefirewallpolicyhandler.go create mode 100644 api/internal/handler/vm/deletefirewallrulehandler.go create mode 100644 api/internal/handler/vm/deleteflavorhandler.go create mode 100644 api/internal/handler/vm/deletefloatingiphandler.go create mode 100644 api/internal/handler/vm/deleteimagehandler.go create mode 100644 api/internal/handler/vm/deletenetworkhandler.go create mode 100644 api/internal/handler/vm/deletenetworksegmentrangeshandler.go create mode 100644 api/internal/handler/vm/deletenodehandler.go create mode 100644 api/internal/handler/vm/deleteporthandler.go create mode 100644 api/internal/handler/vm/deleterouterhandler.go create mode 100644 api/internal/handler/vm/deletesecuritygrouphandler.go create mode 100644 api/internal/handler/vm/deletesecuritygrouprulehandler.go create mode 100644 api/internal/handler/vm/deleteserverhandler.go create mode 100644 api/internal/handler/vm/deletesubnethandler.go create mode 100644 api/internal/handler/vm/deletevolumehandler.go create mode 100644 api/internal/handler/vm/deletevolumetypehandler.go create mode 100644 api/internal/handler/vm/getcomputelimitshandler.go create mode 100644 api/internal/handler/vm/getimagenumhandler.go create mode 100644 api/internal/handler/vm/getnetworknumhandler.go create mode 100644 api/internal/handler/vm/getserversdetailedbyidhandler.go create mode 100644 api/internal/handler/vm/getvolumedetailedbyidhandler.go create mode 100644 api/internal/handler/vm/getvolumelimitshandler.go create mode 100644 api/internal/handler/vm/listfirewallgroupshandler.go create mode 100644 api/internal/handler/vm/listfirewallpolicieshandler.go create mode 100644 api/internal/handler/vm/listfirewallruleshandler.go create mode 100644 api/internal/handler/vm/listflavorsdetailhandler.go create mode 100644 api/internal/handler/vm/listfloatingipshandler.go create mode 100644 api/internal/handler/vm/listimageshandler.go create mode 100644 api/internal/handler/vm/listnetworksegmentrangesrangehandler.go create mode 100644 api/internal/handler/vm/listnetworkshandler.go create mode 100644 api/internal/handler/vm/listnodeshandler.go create mode 100644 api/internal/handler/vm/listportshandler.go create mode 100644 api/internal/handler/vm/listroutershandler.go create mode 100644 api/internal/handler/vm/listsecuritygroupruleshandler.go create mode 100644 api/internal/handler/vm/listsecuritygroupshandler.go create mode 100644 api/internal/handler/vm/listserverhandler.go create mode 100644 api/internal/handler/vm/listserversdetailedhandler.go create mode 100644 api/internal/handler/vm/listsubnetshandler.go create mode 100644 api/internal/handler/vm/listvolumesdetailhandler.go create mode 100644 api/internal/handler/vm/listvolumeshandler.go create mode 100644 api/internal/handler/vm/listvolumetypeshandler.go create mode 100644 api/internal/handler/vm/migrateserverhandler.go create mode 100644 api/internal/handler/vm/pauseserverhandler.go create mode 100644 api/internal/handler/vm/rebootserverhandler.go create mode 100644 api/internal/handler/vm/removesecuritygrouphandler.go create mode 100644 api/internal/handler/vm/rescueserverhandler.go create mode 100644 api/internal/handler/vm/resizeserverhandler.go create mode 100644 api/internal/handler/vm/shelveserverhandler.go create mode 100644 api/internal/handler/vm/showfirewallgroupdetailshandler.go create mode 100644 api/internal/handler/vm/showfirewallpolicydetailshandler.go create mode 100644 api/internal/handler/vm/showfirewallruledetailshandler.go create mode 100644 api/internal/handler/vm/showfloatingipdetailshandler.go create mode 100644 api/internal/handler/vm/shownetworkdetailshandler.go create mode 100644 api/internal/handler/vm/shownetworksegmentrangedetailshandler.go create mode 100644 api/internal/handler/vm/shownodedetailshandler.go create mode 100644 api/internal/handler/vm/showportdetailshandler.go create mode 100644 api/internal/handler/vm/showrouterdetailshandler.go create mode 100644 api/internal/handler/vm/showsecuritygrouphandler.go create mode 100644 api/internal/handler/vm/showsecuritygrouprulehandler.go create mode 100644 api/internal/handler/vm/startserverhandler.go create mode 100644 api/internal/handler/vm/stopserverhandler.go create mode 100644 api/internal/handler/vm/suspendserverhandler.go create mode 100644 api/internal/handler/vm/unpauseserverhandler.go create mode 100644 api/internal/handler/vm/unrescuehandler.go create mode 100644 api/internal/handler/vm/updatefirewallgrouphandler.go create mode 100644 api/internal/handler/vm/updatefloatingiphandler.go create mode 100644 api/internal/handler/vm/updatenetworkhandler.go create mode 100644 api/internal/handler/vm/updatenetworksegmentrangeshandler.go create mode 100644 api/internal/handler/vm/updateporthandler.go create mode 100644 api/internal/handler/vm/updaterouterhandler.go create mode 100644 api/internal/handler/vm/updatesecuritygrouphandler.go create mode 100644 api/internal/handler/vm/updateserverhandler.go create mode 100644 api/internal/handler/vm/updatesubnethandler.go create mode 100644 api/internal/handler/vm/updatevolumehandler.go create mode 100644 api/internal/handler/vm/uploadimagehandler.go diff --git a/api/internal/handler/adapters/adapterslisthandler.go b/api/internal/handler/adapters/adapterslisthandler.go new file mode 100644 index 00000000..3d84c0c8 --- /dev/null +++ b/api/internal/handler/adapters/adapterslisthandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func AdaptersListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AdapterQueryReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewAdaptersListLogic(r.Context(), svcCtx) + resp, err := l.AdaptersList(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/clusterlisthandler.go b/api/internal/handler/adapters/clusterlisthandler.go new file mode 100644 index 00000000..f1863304 --- /dev/null +++ b/api/internal/handler/adapters/clusterlisthandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ClusterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ClusterReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewClusterListLogic(r.Context(), svcCtx) + resp, err := l.ClusterList(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/createadapterhandler.go b/api/internal/handler/adapters/createadapterhandler.go new file mode 100644 index 00000000..42b60968 --- /dev/null +++ b/api/internal/handler/adapters/createadapterhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AdapterCreateReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewCreateAdapterLogic(r.Context(), svcCtx) + resp, err := l.CreateAdapter(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/createclusterhandler.go b/api/internal/handler/adapters/createclusterhandler.go new file mode 100644 index 00000000..80eaa0de --- /dev/null +++ b/api/internal/handler/adapters/createclusterhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ClusterCreateReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewCreateClusterLogic(r.Context(), svcCtx) + resp, err := l.CreateCluster(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/deleteadapterhandler.go b/api/internal/handler/adapters/deleteadapterhandler.go new file mode 100644 index 00000000..b2e1c7ca --- /dev/null +++ b/api/internal/handler/adapters/deleteadapterhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AdapterDelReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewDeleteAdapterLogic(r.Context(), svcCtx) + resp, err := l.DeleteAdapter(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/deleteclusterhandler.go b/api/internal/handler/adapters/deleteclusterhandler.go new file mode 100644 index 00000000..62e800f1 --- /dev/null +++ b/api/internal/handler/adapters/deleteclusterhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.FId + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewDeleteClusterLogic(r.Context(), svcCtx) + resp, err := l.DeleteCluster(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/getadapterhandler.go b/api/internal/handler/adapters/getadapterhandler.go new file mode 100644 index 00000000..2e4e189d --- /dev/null +++ b/api/internal/handler/adapters/getadapterhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AdapterDelReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewGetAdapterLogic(r.Context(), svcCtx) + resp, err := l.GetAdapter(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/getadapterrelationhandler.go b/api/internal/handler/adapters/getadapterrelationhandler.go new file mode 100644 index 00000000..13212c35 --- /dev/null +++ b/api/internal/handler/adapters/getadapterrelationhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetAdapterRelationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AdapterRelationQueryReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewGetAdapterRelationLogic(r.Context(), svcCtx) + resp, err := l.GetAdapterRelation(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/getclusterhandler.go b/api/internal/handler/adapters/getclusterhandler.go new file mode 100644 index 00000000..865e861f --- /dev/null +++ b/api/internal/handler/adapters/getclusterhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.FId + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewGetClusterLogic(r.Context(), svcCtx) + resp, err := l.GetCluster(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/getclustersumhandler.go b/api/internal/handler/adapters/getclustersumhandler.go new file mode 100644 index 00000000..18fd747e --- /dev/null +++ b/api/internal/handler/adapters/getclustersumhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetClusterSumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ClusterSumReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewGetClusterSumLogic(r.Context(), svcCtx) + resp, err := l.GetClusterSum(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/updateadapterhandler.go b/api/internal/handler/adapters/updateadapterhandler.go new file mode 100644 index 00000000..3800fc16 --- /dev/null +++ b/api/internal/handler/adapters/updateadapterhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AdapterReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewUpdateAdapterLogic(r.Context(), svcCtx) + resp, err := l.UpdateAdapter(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/updateclusterhandler.go b/api/internal/handler/adapters/updateclusterhandler.go new file mode 100644 index 00000000..f5405d64 --- /dev/null +++ b/api/internal/handler/adapters/updateclusterhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ClusterCreateReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewUpdateClusterLogic(r.Context(), svcCtx) + resp, err := l.UpdateCluster(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/createalgorithmhandler.go b/api/internal/handler/ai/createalgorithmhandler.go new file mode 100644 index 00000000..e0ebcb34 --- /dev/null +++ b/api/internal/handler/ai/createalgorithmhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateAlgorithmReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewCreateAlgorithmLogic(r.Context(), svcCtx) + resp, err := l.CreateAlgorithm(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/createdatasethandler.go b/api/internal/handler/ai/createdatasethandler.go new file mode 100644 index 00000000..57bb2728 --- /dev/null +++ b/api/internal/handler/ai/createdatasethandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateDataSetReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewCreateDataSetLogic(r.Context(), svcCtx) + resp, err := l.CreateDataSet(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/createexporttaskhandler.go b/api/internal/handler/ai/createexporttaskhandler.go new file mode 100644 index 00000000..bcc64381 --- /dev/null +++ b/api/internal/handler/ai/createexporttaskhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateExportTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateExportTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewCreateExportTaskLogic(r.Context(), svcCtx) + resp, err := l.CreateExportTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/createnotebookhandler.go b/api/internal/handler/ai/createnotebookhandler.go new file mode 100644 index 00000000..4bf997fc --- /dev/null +++ b/api/internal/handler/ai/createnotebookhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateNotebookReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewCreateNotebookLogic(r.Context(), svcCtx) + resp, err := l.CreateNotebook(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/createprocessortaskhandler.go b/api/internal/handler/ai/createprocessortaskhandler.go new file mode 100644 index 00000000..b2dc6f55 --- /dev/null +++ b/api/internal/handler/ai/createprocessortaskhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateProcessorTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateProcessorTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewCreateProcessorTaskLogic(r.Context(), svcCtx) + resp, err := l.CreateProcessorTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/createservicehandler.go b/api/internal/handler/ai/createservicehandler.go new file mode 100644 index 00000000..dd8ef32a --- /dev/null +++ b/api/internal/handler/ai/createservicehandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateServiceReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewCreateServiceLogic(r.Context(), svcCtx) + resp, err := l.CreateService(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/createtaskhandler.go b/api/internal/handler/ai/createtaskhandler.go new file mode 100644 index 00000000..c1632e63 --- /dev/null +++ b/api/internal/handler/ai/createtaskhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ImportTaskDataReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewCreateTaskLogic(r.Context(), svcCtx) + resp, err := l.CreateTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/createtrainingjobhandler.go b/api/internal/handler/ai/createtrainingjobhandler.go new file mode 100644 index 00000000..f159bf06 --- /dev/null +++ b/api/internal/handler/ai/createtrainingjobhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateTrainingJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateTrainingJobReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewCreateTrainingJobLogic(r.Context(), svcCtx) + resp, err := l.CreateTrainingJob(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/createvisualizationjobhandler.go b/api/internal/handler/ai/createvisualizationjobhandler.go new file mode 100644 index 00000000..b66ffa7c --- /dev/null +++ b/api/internal/handler/ai/createvisualizationjobhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateVisualizationJobReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewCreateVisualizationJobLogic(r.Context(), svcCtx) + resp, err := l.CreateVisualizationJob(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/deletealgorithmhandler.go b/api/internal/handler/ai/deletealgorithmhandler.go new file mode 100644 index 00000000..57630af0 --- /dev/null +++ b/api/internal/handler/ai/deletealgorithmhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteAlgorithmReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewDeleteAlgorithmLogic(r.Context(), svcCtx) + resp, err := l.DeleteAlgorithm(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/deletedatasethandler.go b/api/internal/handler/ai/deletedatasethandler.go new file mode 100644 index 00000000..84288d1c --- /dev/null +++ b/api/internal/handler/ai/deletedatasethandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteDataSetReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewDeleteDataSetLogic(r.Context(), svcCtx) + resp, err := l.DeleteDataSet(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/deleteservicehandler.go b/api/internal/handler/ai/deleteservicehandler.go new file mode 100644 index 00000000..effb9aad --- /dev/null +++ b/api/internal/handler/ai/deleteservicehandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteServiceReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewDeleteServiceLogic(r.Context(), svcCtx) + resp, err := l.DeleteService(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/deletetrainingjobhandler.go b/api/internal/handler/ai/deletetrainingjobhandler.go new file mode 100644 index 00000000..d0666ef7 --- /dev/null +++ b/api/internal/handler/ai/deletetrainingjobhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteTrainingJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteTrainingJobReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewDeleteTrainingJobLogic(r.Context(), svcCtx) + resp, err := l.DeleteTrainingJob(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/getexporttasksofdatasethandler.go b/api/internal/handler/ai/getexporttasksofdatasethandler.go new file mode 100644 index 00000000..bf45832a --- /dev/null +++ b/api/internal/handler/ai/getexporttasksofdatasethandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetExportTasksOfDatasetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetExportTasksOfDatasetReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewGetExportTasksOfDatasetLogic(r.Context(), svcCtx) + resp, err := l.GetExportTasksOfDataset(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go b/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go new file mode 100644 index 00000000..3a7c0337 --- /dev/null +++ b/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetExportTaskStatusOfDatasetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetExportTaskStatusOfDatasetReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewGetExportTaskStatusOfDatasetLogic(r.Context(), svcCtx) + resp, err := l.GetExportTaskStatusOfDataset(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/getlisttrainingjobshandler.go b/api/internal/handler/ai/getlisttrainingjobshandler.go new file mode 100644 index 00000000..3f978dba --- /dev/null +++ b/api/internal/handler/ai/getlisttrainingjobshandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetListTrainingJobsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListTrainingJobsreq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewGetListTrainingJobsLogic(r.Context(), svcCtx) + resp, err := l.GetListTrainingJobs(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/getnotebookstoragehandler.go b/api/internal/handler/ai/getnotebookstoragehandler.go new file mode 100644 index 00000000..2c7618c8 --- /dev/null +++ b/api/internal/handler/ai/getnotebookstoragehandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetNotebookStorageReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewGetNotebookStorageLogic(r.Context(), svcCtx) + resp, err := l.GetNotebookStorage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/getvisualizationjobhandler.go b/api/internal/handler/ai/getvisualizationjobhandler.go new file mode 100644 index 00000000..51f41ed1 --- /dev/null +++ b/api/internal/handler/ai/getvisualizationjobhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetVisualizationJobReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewGetVisualizationJobLogic(r.Context(), svcCtx) + resp, err := l.GetVisualizationJob(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/listalgorithmshandler.go b/api/internal/handler/ai/listalgorithmshandler.go new file mode 100644 index 00000000..56c2ded7 --- /dev/null +++ b/api/internal/handler/ai/listalgorithmshandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListAlgorithmsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListAlgorithmsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewListAlgorithmsLogic(r.Context(), svcCtx) + resp, err := l.ListAlgorithms(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/listclustershandler.go b/api/internal/handler/ai/listclustershandler.go new file mode 100644 index 00000000..50ad73bd --- /dev/null +++ b/api/internal/handler/ai/listclustershandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListClustersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListClustersReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewListClustersLogic(r.Context(), svcCtx) + resp, err := l.ListClusters(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/listdatasethandler.go b/api/internal/handler/ai/listdatasethandler.go new file mode 100644 index 00000000..78f06ffa --- /dev/null +++ b/api/internal/handler/ai/listdatasethandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DataSetReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewListDataSetLogic(r.Context(), svcCtx) + resp, err := l.ListDataSet(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/listimporthandler.go b/api/internal/handler/ai/listimporthandler.go new file mode 100644 index 00000000..32a8c6d0 --- /dev/null +++ b/api/internal/handler/ai/listimporthandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListImportHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListImportTasksReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewListImportLogic(r.Context(), svcCtx) + resp, err := l.ListImport(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/listnotebookhandler.go b/api/internal/handler/ai/listnotebookhandler.go new file mode 100644 index 00000000..b1375aeb --- /dev/null +++ b/api/internal/handler/ai/listnotebookhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListNotebookReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewListNotebookLogic(r.Context(), svcCtx) + resp, err := l.ListNotebook(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/listserviceshandler.go b/api/internal/handler/ai/listserviceshandler.go new file mode 100644 index 00000000..df823191 --- /dev/null +++ b/api/internal/handler/ai/listserviceshandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListServicesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListServicesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewListServicesLogic(r.Context(), svcCtx) + resp, err := l.ListServices(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/mountnotebookstoragehandler.go b/api/internal/handler/ai/mountnotebookstoragehandler.go new file mode 100644 index 00000000..324c9708 --- /dev/null +++ b/api/internal/handler/ai/mountnotebookstoragehandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func MountNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.MountNotebookStorageReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewMountNotebookStorageLogic(r.Context(), svcCtx) + resp, err := l.MountNotebookStorage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/showalgorithmbyuuidhandler.go b/api/internal/handler/ai/showalgorithmbyuuidhandler.go new file mode 100644 index 00000000..a2951560 --- /dev/null +++ b/api/internal/handler/ai/showalgorithmbyuuidhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowAlgorithmByUuidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowAlgorithmByUuidReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewShowAlgorithmByUuidLogic(r.Context(), svcCtx) + resp, err := l.ShowAlgorithmByUuid(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/showservicehandler.go b/api/internal/handler/ai/showservicehandler.go new file mode 100644 index 00000000..d6a9f4b4 --- /dev/null +++ b/api/internal/handler/ai/showservicehandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowServiceReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewShowServiceLogic(r.Context(), svcCtx) + resp, err := l.ShowService(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/startnotebookhandler.go b/api/internal/handler/ai/startnotebookhandler.go new file mode 100644 index 00000000..1416d911 --- /dev/null +++ b/api/internal/handler/ai/startnotebookhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func StartNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.StartNotebookReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewStartNotebookLogic(r.Context(), svcCtx) + resp, err := l.StartNotebook(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/stopnotebookhandler.go b/api/internal/handler/ai/stopnotebookhandler.go new file mode 100644 index 00000000..b6fd7cce --- /dev/null +++ b/api/internal/handler/ai/stopnotebookhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func StopNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.StopNotebookReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewStopNotebookLogic(r.Context(), svcCtx) + resp, err := l.StopNotebook(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/apps/appdetailhandler.go b/api/internal/handler/apps/appdetailhandler.go new file mode 100644 index 00000000..d668a226 --- /dev/null +++ b/api/internal/handler/apps/appdetailhandler.go @@ -0,0 +1,28 @@ +package apps + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func AppDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AppDetailReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := apps.NewAppDetailLogic(r.Context(), svcCtx) + resp, err := l.AppDetail(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/apps/applisthandler.go b/api/internal/handler/apps/applisthandler.go new file mode 100644 index 00000000..823cb985 --- /dev/null +++ b/api/internal/handler/apps/applisthandler.go @@ -0,0 +1,28 @@ +package apps + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func AppListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AppListReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := apps.NewAppListLogic(r.Context(), svcCtx) + resp, err := l.AppList(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/apps/apppodshandler.go b/api/internal/handler/apps/apppodshandler.go new file mode 100644 index 00000000..ef3e0466 --- /dev/null +++ b/api/internal/handler/apps/apppodshandler.go @@ -0,0 +1,28 @@ +package apps + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func AppPodsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AppDetailReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := apps.NewAppPodsLogic(r.Context(), svcCtx) + resp, err := l.AppPods(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/apps/deleteappbyappnamehandler.go b/api/internal/handler/apps/deleteappbyappnamehandler.go new file mode 100644 index 00000000..a6c9efa6 --- /dev/null +++ b/api/internal/handler/apps/deleteappbyappnamehandler.go @@ -0,0 +1,28 @@ +package apps + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteAppReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := apps.NewDeleteAppByAppNameLogic(r.Context(), svcCtx) + resp, err := l.DeleteAppByAppName(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/apps/getappbyappnamehandler.go b/api/internal/handler/apps/getappbyappnamehandler.go new file mode 100644 index 00000000..d7dd16c2 --- /dev/null +++ b/api/internal/handler/apps/getappbyappnamehandler.go @@ -0,0 +1,28 @@ +package apps + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AppDetailReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := apps.NewGetAppByAppNameLogic(r.Context(), svcCtx) + resp, err := l.GetAppByAppName(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/apps/pauseappbyappnamehandler.go b/api/internal/handler/apps/pauseappbyappnamehandler.go new file mode 100644 index 00000000..a53de1ab --- /dev/null +++ b/api/internal/handler/apps/pauseappbyappnamehandler.go @@ -0,0 +1,28 @@ +package apps + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func PauseAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteAppReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := apps.NewPauseAppByAppNameLogic(r.Context(), svcCtx) + resp, err := l.PauseAppByAppName(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/apps/restartappbyappnamehandler.go b/api/internal/handler/apps/restartappbyappnamehandler.go new file mode 100644 index 00000000..94b246af --- /dev/null +++ b/api/internal/handler/apps/restartappbyappnamehandler.go @@ -0,0 +1,28 @@ +package apps + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func RestartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteAppReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := apps.NewRestartAppByAppNameLogic(r.Context(), svcCtx) + resp, err := l.RestartAppByAppName(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/apps/startappbyappnamehandler.go b/api/internal/handler/apps/startappbyappnamehandler.go new file mode 100644 index 00000000..02b6a98b --- /dev/null +++ b/api/internal/handler/apps/startappbyappnamehandler.go @@ -0,0 +1,28 @@ +package apps + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func StartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteAppReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := apps.NewStartAppByAppNameLogic(r.Context(), svcCtx) + resp, err := l.StartAppByAppName(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/apps/updateappbyappnamehandler.go b/api/internal/handler/apps/updateappbyappnamehandler.go new file mode 100644 index 00000000..e72740b8 --- /dev/null +++ b/api/internal/handler/apps/updateappbyappnamehandler.go @@ -0,0 +1,28 @@ +package apps + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteAppReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := apps.NewUpdateAppByAppNameLogic(r.Context(), svcCtx) + resp, err := l.UpdateAppByAppName(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/cloud/cloudlisthandler.go b/api/internal/handler/cloud/cloudlisthandler.go new file mode 100644 index 00000000..22c759c4 --- /dev/null +++ b/api/internal/handler/cloud/cloudlisthandler.go @@ -0,0 +1,21 @@ +package cloud + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func CloudListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := cloud.NewCloudListLogic(r.Context(), svcCtx) + resp, err := l.CloudList() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/cloud/controllermetricshandler.go b/api/internal/handler/cloud/controllermetricshandler.go new file mode 100644 index 00000000..2e02cf43 --- /dev/null +++ b/api/internal/handler/cloud/controllermetricshandler.go @@ -0,0 +1,28 @@ +package cloud + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ControllerMetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ControllerMetricsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := cloud.NewControllerMetricsLogic(r.Context(), svcCtx) + resp, err := l.ControllerMetrics(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/cloud/deleteclusterhandler.go b/api/internal/handler/cloud/deleteclusterhandler.go new file mode 100644 index 00000000..323c25f3 --- /dev/null +++ b/api/internal/handler/cloud/deleteclusterhandler.go @@ -0,0 +1,28 @@ +package cloud + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteClusterReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := cloud.NewDeleteClusterLogic(r.Context(), svcCtx) + resp, err := l.DeleteCluster(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/cloud/deleteyamlhandler.go b/api/internal/handler/cloud/deleteyamlhandler.go new file mode 100644 index 00000000..60a01556 --- /dev/null +++ b/api/internal/handler/cloud/deleteyamlhandler.go @@ -0,0 +1,28 @@ +package cloud + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteYamlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ApplyReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := cloud.NewDeleteYamlLogic(r.Context(), svcCtx) + resp, err := l.DeleteYaml(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/cloud/getclusterlisthandler.go b/api/internal/handler/cloud/getclusterlisthandler.go new file mode 100644 index 00000000..cc04e75d --- /dev/null +++ b/api/internal/handler/cloud/getclusterlisthandler.go @@ -0,0 +1,28 @@ +package cloud + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetClusterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetClusterListReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := cloud.NewGetClusterListLogic(r.Context(), svcCtx) + resp, err := l.GetClusterList(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/cloud/noticetenanthandler.go b/api/internal/handler/cloud/noticetenanthandler.go new file mode 100644 index 00000000..9b3fea29 --- /dev/null +++ b/api/internal/handler/cloud/noticetenanthandler.go @@ -0,0 +1,21 @@ +package cloud + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func NoticeTenantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := cloud.NewNoticeTenantLogic(r.Context(), svcCtx) + resp, err := l.NoticeTenant() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/cloud/registerclusterhandler.go b/api/internal/handler/cloud/registerclusterhandler.go new file mode 100644 index 00000000..f222e5be --- /dev/null +++ b/api/internal/handler/cloud/registerclusterhandler.go @@ -0,0 +1,28 @@ +package cloud + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func RegisterClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.RegisterClusterReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := cloud.NewRegisterClusterLogic(r.Context(), svcCtx) + resp, err := l.RegisterCluster(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/cloud/updatetenanthandler.go b/api/internal/handler/cloud/updatetenanthandler.go new file mode 100644 index 00000000..04b04e32 --- /dev/null +++ b/api/internal/handler/cloud/updatetenanthandler.go @@ -0,0 +1,28 @@ +package cloud + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateTenantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateTenantReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := cloud.NewUpdateTenantLogic(r.Context(), svcCtx) + resp, err := l.UpdateTenant(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/centerresourceshandler.go b/api/internal/handler/core/centerresourceshandler.go new file mode 100644 index 00000000..6c7ae71e --- /dev/null +++ b/api/internal/handler/core/centerresourceshandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func CenterResourcesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewCenterResourcesLogic(r.Context(), svcCtx) + resp, err := l.CenterResources() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/committaskhandler.go b/api/internal/handler/core/committaskhandler.go new file mode 100644 index 00000000..3bea0b93 --- /dev/null +++ b/api/internal/handler/core/committaskhandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CommitTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CommitTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewCommitTaskLogic(r.Context(), svcCtx) + err := l.CommitTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/api/internal/handler/core/commitvmtaskhandler.go b/api/internal/handler/core/commitvmtaskhandler.go new file mode 100644 index 00000000..f2ca9e4b --- /dev/null +++ b/api/internal/handler/core/commitvmtaskhandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CommitVmTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CommitVmTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewCommitVmTaskLogic(r.Context(), svcCtx) + resp, err := l.CommitVmTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/deletetaskhandler.go b/api/internal/handler/core/deletetaskhandler.go new file mode 100644 index 00000000..e5a735e0 --- /dev/null +++ b/api/internal/handler/core/deletetaskhandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewDeleteTaskLogic(r.Context(), svcCtx) + err := l.DeleteTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/api/internal/handler/core/getcomputilitystatisticshandler.go b/api/internal/handler/core/getcomputilitystatisticshandler.go new file mode 100644 index 00000000..8a03ba36 --- /dev/null +++ b/api/internal/handler/core/getcomputilitystatisticshandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func GetComputilityStatisticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewGetComputilityStatisticsLogic(r.Context(), svcCtx) + resp, err := l.GetComputilityStatistics() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/getcomputingpowerhandler.go b/api/internal/handler/core/getcomputingpowerhandler.go new file mode 100644 index 00000000..9e4c77ed --- /dev/null +++ b/api/internal/handler/core/getcomputingpowerhandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func GetComputingPowerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewGetComputingPowerLogic(r.Context(), svcCtx) + resp, err := l.GetComputingPower() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/getgeneralinfohandler.go b/api/internal/handler/core/getgeneralinfohandler.go new file mode 100644 index 00000000..de4dc89f --- /dev/null +++ b/api/internal/handler/core/getgeneralinfohandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func GetGeneralInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewGetGeneralInfoLogic(r.Context(), svcCtx) + resp, err := l.GetGeneralInfo() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/getregionhandler.go b/api/internal/handler/core/getregionhandler.go new file mode 100644 index 00000000..f85e16c7 --- /dev/null +++ b/api/internal/handler/core/getregionhandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func GetRegionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewGetRegionLogic(r.Context(), svcCtx) + resp, err := l.GetRegion() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/getresourcepanelconfighandler.go b/api/internal/handler/core/getresourcepanelconfighandler.go new file mode 100644 index 00000000..45dde0c1 --- /dev/null +++ b/api/internal/handler/core/getresourcepanelconfighandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func GetResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewGetResourcePanelConfigLogic(r.Context(), svcCtx) + resp, err := l.GetResourcePanelConfig() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/jobtotalhandler.go b/api/internal/handler/core/jobtotalhandler.go new file mode 100644 index 00000000..91caa200 --- /dev/null +++ b/api/internal/handler/core/jobtotalhandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func JobTotalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewJobTotalLogic(r.Context(), svcCtx) + resp, err := l.JobTotal() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/listcenterhandler.go b/api/internal/handler/core/listcenterhandler.go new file mode 100644 index 00000000..cf988c03 --- /dev/null +++ b/api/internal/handler/core/listcenterhandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ListCenterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewListCenterLogic(r.Context(), svcCtx) + resp, err := l.ListCenter() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/listclusterhandler.go b/api/internal/handler/core/listclusterhandler.go new file mode 100644 index 00000000..a2077a06 --- /dev/null +++ b/api/internal/handler/core/listclusterhandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListClusterReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewListClusterLogic(r.Context(), svcCtx) + resp, err := l.ListCluster(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/listdomainresourcehandler.go b/api/internal/handler/core/listdomainresourcehandler.go new file mode 100644 index 00000000..911beacf --- /dev/null +++ b/api/internal/handler/core/listdomainresourcehandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ListDomainResourceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewListDomainResourceLogic(r.Context(), svcCtx) + resp, err := l.ListDomainResource() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/listregionhandler.go b/api/internal/handler/core/listregionhandler.go new file mode 100644 index 00000000..c05760a6 --- /dev/null +++ b/api/internal/handler/core/listregionhandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ListRegionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewListRegionLogic(r.Context(), svcCtx) + resp, err := l.ListRegion() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/metricshandler.go b/api/internal/handler/core/metricshandler.go new file mode 100644 index 00000000..5f715b1d --- /dev/null +++ b/api/internal/handler/core/metricshandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func MetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewMetricsLogic(r.Context(), svcCtx) + err := l.Metrics() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/api/internal/handler/core/nodeassetshandler.go b/api/internal/handler/core/nodeassetshandler.go new file mode 100644 index 00000000..f8bd04a4 --- /dev/null +++ b/api/internal/handler/core/nodeassetshandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func NodeAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewNodeAssetsLogic(r.Context(), svcCtx) + resp, err := l.NodeAssets() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/participantlisthandler.go b/api/internal/handler/core/participantlisthandler.go new file mode 100644 index 00000000..1f122e0f --- /dev/null +++ b/api/internal/handler/core/participantlisthandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ParticipantListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewParticipantListLogic(r.Context(), svcCtx) + resp, err := l.ParticipantList() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/pulltaskinfohandler.go b/api/internal/handler/core/pulltaskinfohandler.go new file mode 100644 index 00000000..ed98c682 --- /dev/null +++ b/api/internal/handler/core/pulltaskinfohandler.go @@ -0,0 +1,28 @@ +package core + +import ( + clientCore "gitlink.org.cn/JointCloud/pcm-coordinator/api/client" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func PullTaskInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req clientCore.PullTaskInfoReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewPullTaskInfoLogic(r.Context(), svcCtx) + resp, err := l.PullTaskInfo((*clientCore.PullTaskInfoReq)(&req)) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/pushtaskinfohandler.go b/api/internal/handler/core/pushtaskinfohandler.go new file mode 100644 index 00000000..fa7f5e91 --- /dev/null +++ b/api/internal/handler/core/pushtaskinfohandler.go @@ -0,0 +1,28 @@ +package core + +import ( + clientCore "gitlink.org.cn/JointCloud/pcm-coordinator/api/client" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func PushTaskInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req clientCore.PushTaskInfoReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewPushTaskInfoLogic(r.Context(), svcCtx) + resp, err := l.PushTaskInfo(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/putresourcepanelconfighandler.go b/api/internal/handler/core/putresourcepanelconfighandler.go new file mode 100644 index 00000000..a425f19a --- /dev/null +++ b/api/internal/handler/core/putresourcepanelconfighandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func PutResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ResourcePanelConfigReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewPutResourcePanelConfigLogic(r.Context(), svcCtx) + err := l.PutResourcePanelConfig(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/api/internal/handler/core/scheduletaskbyyamlhandler.go b/api/internal/handler/core/scheduletaskbyyamlhandler.go new file mode 100644 index 00000000..1841a389 --- /dev/null +++ b/api/internal/handler/core/scheduletaskbyyamlhandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ScheduleTaskByYamlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ScheduleTaskByYamlReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewScheduleTaskByYamlLogic(r.Context(), svcCtx) + err := l.ScheduleTaskByYaml(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/api/internal/handler/core/syncclusterloadhandler.go b/api/internal/handler/core/syncclusterloadhandler.go new file mode 100644 index 00000000..ff36e15b --- /dev/null +++ b/api/internal/handler/core/syncclusterloadhandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func SyncClusterLoadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.SyncClusterLoadReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewSyncClusterLoadLogic(r.Context(), svcCtx) + err := l.SyncClusterLoad(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/api/internal/handler/core/taskdetailhandler.go b/api/internal/handler/core/taskdetailhandler.go new file mode 100644 index 00000000..e97f2706 --- /dev/null +++ b/api/internal/handler/core/taskdetailhandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func TaskDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.TaskDetailReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewTaskDetailLogic(r.Context(), svcCtx) + resp, err := l.TaskDetail(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/tasklisthandler.go b/api/internal/handler/core/tasklisthandler.go new file mode 100644 index 00000000..7b239009 --- /dev/null +++ b/api/internal/handler/core/tasklisthandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func TaskListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.TaskListReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewTaskListLogic(r.Context(), svcCtx) + resp, err := l.TaskList(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/adddicthandler.go b/api/internal/handler/dictionary/adddicthandler.go new file mode 100644 index 00000000..9abc0f7a --- /dev/null +++ b/api/internal/handler/dictionary/adddicthandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func AddDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DictEditReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewAddDictLogic(r.Context(), svcCtx) + resp, err := l.AddDict(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/adddictitemhandler.go b/api/internal/handler/dictionary/adddictitemhandler.go new file mode 100644 index 00000000..c1ab2c69 --- /dev/null +++ b/api/internal/handler/dictionary/adddictitemhandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func AddDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DictItemEditReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewAddDictItemLogic(r.Context(), svcCtx) + resp, err := l.AddDictItem(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/deletedicthandler.go b/api/internal/handler/dictionary/deletedicthandler.go new file mode 100644 index 00000000..435f529e --- /dev/null +++ b/api/internal/handler/dictionary/deletedicthandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CId + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewDeleteDictLogic(r.Context(), svcCtx) + resp, err := l.DeleteDict(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/deletedictitemhandler.go b/api/internal/handler/dictionary/deletedictitemhandler.go new file mode 100644 index 00000000..e029202f --- /dev/null +++ b/api/internal/handler/dictionary/deletedictitemhandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CId + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewDeleteDictItemLogic(r.Context(), svcCtx) + resp, err := l.DeleteDictItem(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/editdicthandler.go b/api/internal/handler/dictionary/editdicthandler.go new file mode 100644 index 00000000..b63e41be --- /dev/null +++ b/api/internal/handler/dictionary/editdicthandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func EditDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DictEditReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewEditDictLogic(r.Context(), svcCtx) + resp, err := l.EditDict(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/editdictitemhandler.go b/api/internal/handler/dictionary/editdictitemhandler.go new file mode 100644 index 00000000..f4f2fd6c --- /dev/null +++ b/api/internal/handler/dictionary/editdictitemhandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func EditDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DictItemEditReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewEditDictItemLogic(r.Context(), svcCtx) + resp, err := l.EditDictItem(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/getdicthandler.go b/api/internal/handler/dictionary/getdicthandler.go new file mode 100644 index 00000000..4a958990 --- /dev/null +++ b/api/internal/handler/dictionary/getdicthandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CId + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewGetDictLogic(r.Context(), svcCtx) + resp, err := l.GetDict(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/getdictitemhandler.go b/api/internal/handler/dictionary/getdictitemhandler.go new file mode 100644 index 00000000..60d8ce06 --- /dev/null +++ b/api/internal/handler/dictionary/getdictitemhandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CId + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewGetDictItemLogic(r.Context(), svcCtx) + resp, err := l.GetDictItem(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/listdicthandler.go b/api/internal/handler/dictionary/listdicthandler.go new file mode 100644 index 00000000..5c34a136 --- /dev/null +++ b/api/internal/handler/dictionary/listdicthandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DictReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewListDictLogic(r.Context(), svcCtx) + resp, err := l.ListDict(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/listdictitembycodehandler.go b/api/internal/handler/dictionary/listdictitembycodehandler.go new file mode 100644 index 00000000..98c6feab --- /dev/null +++ b/api/internal/handler/dictionary/listdictitembycodehandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListDictItemByCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DictCodeReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewListDictItemByCodeLogic(r.Context(), svcCtx) + resp, err := l.ListDictItemByCode(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/listdictitemhandler.go b/api/internal/handler/dictionary/listdictitemhandler.go new file mode 100644 index 00000000..5607ee04 --- /dev/null +++ b/api/internal/handler/dictionary/listdictitemhandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DictItemReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewListDictItemLogic(r.Context(), svcCtx) + resp, err := l.ListDictItem(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/hpc/commithpctaskhandler.go b/api/internal/handler/hpc/commithpctaskhandler.go new file mode 100644 index 00000000..a2043def --- /dev/null +++ b/api/internal/handler/hpc/commithpctaskhandler.go @@ -0,0 +1,28 @@ +package hpc + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CommitHpcTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CommitHpcTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := hpc.NewCommitHpcTaskLogic(r.Context(), svcCtx) + resp, err := l.CommitHpcTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/hpc/listhistoryjobhandler.go b/api/internal/handler/hpc/listhistoryjobhandler.go new file mode 100644 index 00000000..ec50c854 --- /dev/null +++ b/api/internal/handler/hpc/listhistoryjobhandler.go @@ -0,0 +1,28 @@ +package hpc + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListHistoryJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListHistoryJobReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := hpc.NewListHistoryJobLogic(r.Context(), svcCtx) + resp, err := l.ListHistoryJob(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/hpc/listjobhandler.go b/api/internal/handler/hpc/listjobhandler.go new file mode 100644 index 00000000..c9572a7e --- /dev/null +++ b/api/internal/handler/hpc/listjobhandler.go @@ -0,0 +1,28 @@ +package hpc + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListJobReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := hpc.NewListJobLogic(r.Context(), svcCtx) + resp, err := l.ListJob(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/hpc/queueassetshandler.go b/api/internal/handler/hpc/queueassetshandler.go new file mode 100644 index 00000000..97c0c5d4 --- /dev/null +++ b/api/internal/handler/hpc/queueassetshandler.go @@ -0,0 +1,21 @@ +package hpc + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func QueueAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := hpc.NewQueueAssetsLogic(r.Context(), svcCtx) + resp, err := l.QueueAssets() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/image/chunkhandler.go b/api/internal/handler/image/chunkhandler.go new file mode 100644 index 00000000..87c8b143 --- /dev/null +++ b/api/internal/handler/image/chunkhandler.go @@ -0,0 +1,21 @@ +package image + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ChunkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := image.NewChunkLogic(r.Context(), svcCtx) + err := l.Chunk() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/api/internal/handler/image/datasetcheckhandler.go b/api/internal/handler/image/datasetcheckhandler.go new file mode 100644 index 00000000..b127987b --- /dev/null +++ b/api/internal/handler/image/datasetcheckhandler.go @@ -0,0 +1,28 @@ +package image + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DataSetCheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CheckReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := image.NewDataSetCheckLogic(r.Context(), svcCtx) + resp, err := l.DataSetCheck(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/image/imagelisthandler.go b/api/internal/handler/image/imagelisthandler.go new file mode 100644 index 00000000..cbd14726 --- /dev/null +++ b/api/internal/handler/image/imagelisthandler.go @@ -0,0 +1,21 @@ +package image + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ImageListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := image.NewImageListLogic(r.Context(), svcCtx) + resp, err := l.ImageList() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/image/uploaddatasethandler.go b/api/internal/handler/image/uploaddatasethandler.go new file mode 100644 index 00000000..ffe715c6 --- /dev/null +++ b/api/internal/handler/image/uploaddatasethandler.go @@ -0,0 +1,21 @@ +package image + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func UploadDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := image.NewUploadDataSetLogic(r.Context(), svcCtx) + err := l.UploadDataSet() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/api/internal/handler/image/uploadhandler.go b/api/internal/handler/image/uploadhandler.go new file mode 100644 index 00000000..66cd4592 --- /dev/null +++ b/api/internal/handler/image/uploadhandler.go @@ -0,0 +1,21 @@ +package image + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func UploadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := image.NewUploadLogic(r.Context(), svcCtx) + err := l.Upload() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/api/internal/handler/routes.go b/api/internal/handler/routes.go new file mode 100644 index 00000000..50f31d6c --- /dev/null +++ b/api/internal/handler/routes.go @@ -0,0 +1,1166 @@ +// Code generated by goctl. DO NOT EDIT. +package handler + +import ( + "net/http" + + adapters "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/adapters" + ai "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/ai" + apps "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/apps" + cloud "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/cloud" + core "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/core" + dictionary "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/dictionary" + hpc "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/hpc" + image "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/image" + schedule "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/schedule" + storage "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/storage" + storelink "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/storelink" + vm "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + + "github.com/zeromicro/go-zero/rest" +) + +func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodGet, + Path: "/core/participantList", + Handler: core.ParticipantListHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/core/scheduleTaskByYaml", + Handler: core.ScheduleTaskByYamlHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/core/commitTask", + Handler: core.CommitTaskHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/core/commitVmTask", + Handler: core.CommitVmTaskHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/core/deleteTask/:id", + Handler: core.DeleteTaskHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/taskList", + Handler: core.TaskListHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/taskDetail/:taskId", + Handler: core.TaskDetailHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/jobTotal", + Handler: core.JobTotalHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/listCenter", + Handler: core.ListCenterHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/listCluster/:centerId", + Handler: core.ListClusterHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/getRegion", + Handler: core.GetRegionHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/listRegion", + Handler: core.ListRegionHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/getComputingPower", + Handler: core.GetComputingPowerHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/getGeneralInfo", + Handler: core.GetGeneralInfoHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/listDomainResource", + Handler: core.ListDomainResourceHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/getResourcePanelConfigHandler", + Handler: core.GetResourcePanelConfigHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/core/resourcePanelConfigHandler", + Handler: core.PutResourcePanelConfigHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/getComputilityStatistics", + Handler: core.GetComputilityStatisticsHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/assets", + Handler: core.NodeAssetsHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/centerResources", + Handler: core.CenterResourcesHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/core/syncClusterLoad", + Handler: core.SyncClusterLoadHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/metrics", + Handler: core.MetricsHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/pullTaskInfo", + Handler: core.PullTaskInfoHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/core/pushTaskInfo", + Handler: core.PushTaskInfoHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodPost, + Path: "/hpc/commitHpcTask", + Handler: hpc.CommitHpcTaskHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/hpc/listJob", + Handler: hpc.ListJobHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/hpc/listHistoryJob", + Handler: hpc.ListHistoryJobHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/hpc/queueAssets", + Handler: hpc.QueueAssetsHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodGet, + Path: "/task/list", + Handler: cloud.CloudListHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/cloud/DeleteYaml", + Handler: cloud.DeleteYamlHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/cloud/controller/Metrics", + Handler: cloud.ControllerMetricsHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/cloud/registerCluster", + Handler: cloud.RegisterClusterHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/cloud/deleteCluster", + Handler: cloud.DeleteClusterHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/cloud/noticeTenant", + Handler: cloud.NoticeTenantHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/cloud/updateTenant", + Handler: cloud.UpdateTenantHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/clusterList", + Handler: cloud.GetClusterListHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodGet, + Path: "/ai/listDataSet/:projectId", + Handler: ai.ListDataSetHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/createDataSet/:projectId", + Handler: ai.CreateDataSetHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/ai/deleteDataSet/:projectId/:datasetId", + Handler: ai.DeleteDataSetHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/CreateTask/:projectId/:datasetId", + Handler: ai.CreateTaskHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/ListImport/:projectId/:datasetId", + Handler: ai.ListImportHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/GetListTrainingJobs/:projectId", + Handler: ai.GetListTrainingJobsHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/ai/DeleteTrainingJob/:projectId/:trainingJobId", + Handler: ai.DeleteTrainingJobHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/CreateAlgorithm/:projectId", + Handler: ai.CreateAlgorithmHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/ListAlgorithms/:projectId", + Handler: ai.ListAlgorithmsHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/ai/DeleteAlgorithm/:projectId/:algorithmId", + Handler: ai.DeleteAlgorithmHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/CreateTrainingJob/:projectId", + Handler: ai.CreateTrainingJobHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/ShowAlgorithmByUuid/:projectId/:algorithmId", + Handler: ai.ShowAlgorithmByUuidHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/CreateExportTask/:projectId/:datasetId", + Handler: ai.CreateExportTaskHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/GetExportTasksOfDataset/:projectId/:datasetId", + Handler: ai.GetExportTasksOfDatasetHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/GetExportTaskStatusOfDataset/:projectId/:resourceId/:taskId", + Handler: ai.GetExportTaskStatusOfDatasetHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/CreateProcessorTask", + Handler: ai.CreateProcessorTaskHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/CreateService/:projectId", + Handler: ai.CreateServiceHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/ListServices/:projectId", + Handler: ai.ListServicesHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/ShowService/:projectId/:serviceId", + Handler: ai.ShowServiceHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/ai/DeleteService/:projectId/:serviceId", + Handler: ai.DeleteServiceHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/ListClusters", + Handler: ai.ListClustersHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/listNotebook", + Handler: ai.ListNotebookHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/createNotebook", + Handler: ai.CreateNotebookHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/startNotebook", + Handler: ai.StartNotebookHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/stopNotebook", + Handler: ai.StopNotebookHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/getNotebookStorage", + Handler: ai.GetNotebookStorageHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/mountNotebookStorage", + Handler: ai.MountNotebookStorageHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/getVisualizationJob", + Handler: ai.GetVisualizationJobHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/CreateVisualizationJob", + Handler: ai.CreateVisualizationJobHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodGet, + Path: "/storage/screenStorage", + Handler: storage.ScreenStorageHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/storage/dailyPowerScreen", + Handler: storage.DailyPowerScreenHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/storage/perCenterComputerPowers", + Handler: storage.PerCenterComputerPowersHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodPost, + Path: "/upload", + Handler: image.UploadHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/chunk", + Handler: image.ChunkHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/image/list", + Handler: image.ImageListHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/dataSet/check/:fileMd5", + Handler: image.DataSetCheckHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/dataSet/upload", + Handler: image.UploadDataSetHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodGet, + Path: "/vm/getComputeLimits", + Handler: vm.GetComputeLimitsHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/getVolumeLimits", + Handler: vm.GetVolumeLimitsHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/getNetworkNum", + Handler: vm.GetNetworkNumHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/getImageNum", + Handler: vm.GetImageNumHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listServer", + Handler: vm.ListServerHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listServersDetailed", + Handler: vm.ListServersDetailedHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteServer", + Handler: vm.DeleteServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createServer", + Handler: vm.CreateServerHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/getServersDetailedById", + Handler: vm.GetServersDetailedByIdHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updateServer", + Handler: vm.UpdateServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/startServer", + Handler: vm.StartServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/stopServer", + Handler: vm.StopServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/rebootServer", + Handler: vm.RebootServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/pauseServer", + Handler: vm.PauseServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/unpauseServer", + Handler: vm.UnpauseServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/resizeServer", + Handler: vm.ResizeServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/migrateServer", + Handler: vm.MigrateServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/shelveServer", + Handler: vm.ShelveServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/changeAdministrativePassword", + Handler: vm.ChangeAdministrativePasswordHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/rescueServer", + Handler: vm.RescueServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/unRescueServer", + Handler: vm.UnRescueHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/suspendServer", + Handler: vm.SuspendServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/addSecurityGroupToServer", + Handler: vm.AddSecurityGroupToServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/removeSecurityGroup", + Handler: vm.RemoveSecurityGroupHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createFlavor", + Handler: vm.CreateFlavorHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/deleteFlavor", + Handler: vm.DeleteFlavorHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listImages", + Handler: vm.ListImagesHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteImage", + Handler: vm.DeleteImageHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createImage", + Handler: vm.CreateImageHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/uploadImage", + Handler: vm.UploadImageHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listNetworks", + Handler: vm.ListNetworksHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteNetwork", + Handler: vm.DeleteNetworkHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createNetwork", + Handler: vm.CreateNetworkHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createSubnet", + Handler: vm.CreateSubnetHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showNetworkDetails", + Handler: vm.ShowNetworkDetailsHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updateNetwork", + Handler: vm.UpdateNetworkHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/bulkCreateNetworks", + Handler: vm.BulkCreateNetworksHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listSubnets", + Handler: vm.ListSubnetsHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteSubnet", + Handler: vm.DeleteSubnetHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updateSubnet", + Handler: vm.UpdateSubnetHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listNetworkSegmentRanges", + Handler: vm.ListNetworkSegmentRangesRangeHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createNetworkSegmentRange", + Handler: vm.CreateNetworkSegmentRangeHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteNetworkSegmentRanges", + Handler: vm.DeleteNetworkSegmentRangesHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updateNetworkSegmentRanges", + Handler: vm.UpdateNetworkSegmentRangesHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showNetworkSegmentRangeDetails", + Handler: vm.ShowNetworkSegmentRangeDetailsHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createPort", + Handler: vm.CreatePortHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listPortsReq", + Handler: vm.ListPortsHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deletePort", + Handler: vm.DeletePortHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updatePort", + Handler: vm.UpdatePortHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showPortDetails", + Handler: vm.ShowPortDetailsHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createRouter", + Handler: vm.CreateRouterHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listRouters", + Handler: vm.ListRoutersHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteRouter", + Handler: vm.DeleteRouterHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updateRouter", + Handler: vm.UpdateRouterHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showRouterDetails", + Handler: vm.ShowRouterDetailsHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createFloatingIP", + Handler: vm.CreateFloatingIPHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listFloatingIPs", + Handler: vm.ListFloatingIPsHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteFloatingIP", + Handler: vm.DeleteFloatingIPHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updateFloatingIP", + Handler: vm.UpdateFloatingIPHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showFloatingIPDetails", + Handler: vm.ShowFloatingIPDetailsHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createFirewallGroup", + Handler: vm.CreateFirewallGroupHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listFirewallGroups", + Handler: vm.ListFirewallGroupsHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteFirewallGroup", + Handler: vm.DeleteFirewallGroupHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updateFirewallGroup", + Handler: vm.UpdateFirewallGroupHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showFirewallGroupDetails", + Handler: vm.ShowFirewallGroupDetailsHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createFirewallPolicy", + Handler: vm.CreateFirewallPolicyHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listFirewallPolicies", + Handler: vm.ListFirewallPoliciesHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteFirewallPolicy", + Handler: vm.DeleteFirewallPolicyHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showFirewallRuleDetails", + Handler: vm.ShowFirewallRuleDetailsHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showFirewallPolicyDetails", + Handler: vm.ShowFirewallPolicyDetailsHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createFirewallRule", + Handler: vm.CreateFirewallRuleHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listFirewallRules", + Handler: vm.ListFirewallRulesHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteFirewallRule", + Handler: vm.DeleteFirewallRuleHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createSecurityGroup", + Handler: vm.CreateSecurityGroupHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listSecurityGroups", + Handler: vm.ListSecurityGroupsHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteSecurityGroup", + Handler: vm.DeleteSecurityGroupHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updateSecurityGroup", + Handler: vm.UpdateSecurityGroupHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showSecurityGroup", + Handler: vm.ShowSecurityGroupHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createSecurityGroupRule", + Handler: vm.CreateSecurityGroupRuleHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listSecurityGroupRules", + Handler: vm.ListSecurityGroupRulesHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteSecurityGroupRule", + Handler: vm.DeleteSecurityGroupRuleHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showSecurityGroupRule", + Handler: vm.ShowSecurityGroupRuleHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listVolumesDetail", + Handler: vm.ListVolumesDetailHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteVolume", + Handler: vm.DeleteVolumeHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createVolume", + Handler: vm.CreateVolumeHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listFlavorsDetail", + Handler: vm.ListFlavorsDetailHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listVolumeTypes", + Handler: vm.ListVolumeTypesHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updateVolume", + Handler: vm.UpdateVolumeHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createVolumeTypes", + Handler: vm.CreateVolumeTypesHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteVolumeType", + Handler: vm.DeleteVolumeTypeHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listVolumes", + Handler: vm.ListVolumesHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/getVolumeDetailedById", + Handler: vm.GetVolumeDetailedByIdHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listNodes", + Handler: vm.ListNodesHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createNode", + Handler: vm.CreateNodeHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteNode", + Handler: vm.DeleteNodeHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showNodeDetails", + Handler: vm.ShowNodeDetailsHandler(serverCtx), + }, + }, + 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), + }, + { + Method: http.MethodDelete, + Path: "/storelink/deleteImage", + Handler: storelink.DeleteLinkImageHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/storelink/submitTask", + Handler: storelink.SubmitLinkTaskHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/storelink/getTask", + Handler: storelink.GetLinkTaskHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/storelink/deleteTask", + Handler: storelink.DeleteLinkTaskHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/storelink/getParticipants", + Handler: storelink.GetParticipantsHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/storelink/getResourceSpecs", + Handler: storelink.GetAISpecsHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodGet, + Path: "/apps/list", + Handler: apps.AppListHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/apps/distribute/:appName", + Handler: apps.AppDetailHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/apps/pods/:appName", + Handler: apps.AppPodsHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/apps/getAppByAppName/:appName", + Handler: apps.GetAppByAppNameHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/apps/deleteApp", + Handler: apps.DeleteAppByAppNameHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/apps/updateApp", + Handler: apps.UpdateAppByAppNameHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/apps/restartApp", + Handler: apps.RestartAppByAppNameHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/apps/pauseApp", + Handler: apps.PauseAppByAppNameHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/apps/startApp", + Handler: apps.StartAppByAppNameHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodGet, + Path: "/adapter/list", + Handler: adapters.AdaptersListHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/adapter/create", + Handler: adapters.CreateAdapterHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/adapter/update", + Handler: adapters.UpdateAdapterHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/adapter/delete", + Handler: adapters.DeleteAdapterHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/adapter/get", + Handler: adapters.GetAdapterHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/adapter/cluster/list", + Handler: adapters.ClusterListHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/adapter/cluster/create", + Handler: adapters.CreateClusterHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/adapter/cluster/update", + Handler: adapters.UpdateClusterHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/adapter/cluster/delete", + Handler: adapters.DeleteClusterHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/adapter/cluster/get", + Handler: adapters.GetClusterHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/adapter/relation", + Handler: adapters.GetAdapterRelationHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/adapter/clusterSum", + Handler: adapters.GetClusterSumHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodGet, + Path: "/schedule/ai/getResourceTypes", + Handler: schedule.ScheduleGetAiResourceTypesHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/schedule/ai/getTaskTypes", + Handler: schedule.ScheduleGetAiTaskTypesHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/schedule/ai/getDatasets", + Handler: schedule.ScheduleGetDatasetsHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/schedule/ai/getStrategies", + Handler: schedule.ScheduleGetStrategyHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/schedule/submit", + Handler: schedule.ScheduleSubmitHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodGet, + Path: "/dict/:id", + Handler: dictionary.GetDictHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/dicts", + Handler: dictionary.ListDictHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/dict", + Handler: dictionary.AddDictHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/dict", + Handler: dictionary.EditDictHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/dict/:id", + Handler: dictionary.DeleteDictHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/dictItem/:id", + Handler: dictionary.GetDictItemHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/dictItems", + Handler: dictionary.ListDictItemHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/dictItem", + Handler: dictionary.AddDictItemHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/dictItem", + Handler: dictionary.EditDictItemHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/dictItem/:id", + Handler: dictionary.DeleteDictItemHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/dictItem/code/:dictCode", + Handler: dictionary.ListDictItemByCodeHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) +} diff --git a/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go b/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go new file mode 100644 index 00000000..430786f2 --- /dev/null +++ b/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go @@ -0,0 +1,21 @@ +package schedule + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ScheduleGetAiResourceTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := schedule.NewScheduleGetAiResourceTypesLogic(r.Context(), svcCtx) + resp, err := l.ScheduleGetAiResourceTypes() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/schedule/schedulegetaitasktypeshandler.go b/api/internal/handler/schedule/schedulegetaitasktypeshandler.go new file mode 100644 index 00000000..5be11070 --- /dev/null +++ b/api/internal/handler/schedule/schedulegetaitasktypeshandler.go @@ -0,0 +1,21 @@ +package schedule + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ScheduleGetAiTaskTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := schedule.NewScheduleGetAiTaskTypesLogic(r.Context(), svcCtx) + resp, err := l.ScheduleGetAiTaskTypes() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/schedule/schedulegetdatasetshandler.go b/api/internal/handler/schedule/schedulegetdatasetshandler.go new file mode 100644 index 00000000..da285546 --- /dev/null +++ b/api/internal/handler/schedule/schedulegetdatasetshandler.go @@ -0,0 +1,21 @@ +package schedule + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ScheduleGetDatasetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := schedule.NewScheduleGetDatasetsLogic(r.Context(), svcCtx) + resp, err := l.ScheduleGetDatasets() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/schedule/schedulegetstrategyhandler.go b/api/internal/handler/schedule/schedulegetstrategyhandler.go new file mode 100644 index 00000000..2ee88fba --- /dev/null +++ b/api/internal/handler/schedule/schedulegetstrategyhandler.go @@ -0,0 +1,21 @@ +package schedule + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ScheduleGetStrategyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := schedule.NewScheduleGetStrategyLogic(r.Context(), svcCtx) + resp, err := l.ScheduleGetStrategy() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/schedule/schedulesubmithandler.go b/api/internal/handler/schedule/schedulesubmithandler.go new file mode 100644 index 00000000..a536f649 --- /dev/null +++ b/api/internal/handler/schedule/schedulesubmithandler.go @@ -0,0 +1,28 @@ +package schedule + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ScheduleSubmitHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ScheduleReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := schedule.NewScheduleSubmitLogic(r.Context(), svcCtx) + resp, err := l.ScheduleSubmit(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storage/dailypowerscreenhandler.go b/api/internal/handler/storage/dailypowerscreenhandler.go new file mode 100644 index 00000000..48844f39 --- /dev/null +++ b/api/internal/handler/storage/dailypowerscreenhandler.go @@ -0,0 +1,28 @@ +package storage + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storage" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DailyPowerScreenHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DailyPowerScreenReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storage.NewDailyPowerScreenLogic(r.Context(), svcCtx) + resp, err := l.DailyPowerScreen(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storage/percentercomputerpowershandler.go b/api/internal/handler/storage/percentercomputerpowershandler.go new file mode 100644 index 00000000..2e1b5f78 --- /dev/null +++ b/api/internal/handler/storage/percentercomputerpowershandler.go @@ -0,0 +1,28 @@ +package storage + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storage" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func PerCenterComputerPowersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.PerCenterComputerPowersReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storage.NewPerCenterComputerPowersLogic(r.Context(), svcCtx) + resp, err := l.PerCenterComputerPowers(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storage/screenstoragehandler.go b/api/internal/handler/storage/screenstoragehandler.go new file mode 100644 index 00000000..8a8a2bec --- /dev/null +++ b/api/internal/handler/storage/screenstoragehandler.go @@ -0,0 +1,28 @@ +package storage + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storage" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ScreenStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.StorageScreenReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storage.NewScreenStorageLogic(r.Context(), svcCtx) + resp, err := l.ScreenStorage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storelink/deletelinkimagehandler.go b/api/internal/handler/storelink/deletelinkimagehandler.go new file mode 100644 index 00000000..fc56fe9d --- /dev/null +++ b/api/internal/handler/storelink/deletelinkimagehandler.go @@ -0,0 +1,28 @@ +package storelink + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteLinkImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteLinkImageReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storelink.NewDeleteLinkImageLogic(r.Context(), svcCtx) + resp, err := l.DeleteLinkImage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storelink/deletelinktaskhandler.go b/api/internal/handler/storelink/deletelinktaskhandler.go new file mode 100644 index 00000000..536b3ae9 --- /dev/null +++ b/api/internal/handler/storelink/deletelinktaskhandler.go @@ -0,0 +1,28 @@ +package storelink + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteLinkTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteLinkTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storelink.NewDeleteLinkTaskLogic(r.Context(), svcCtx) + resp, err := l.DeleteLinkTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storelink/getaispecshandler.go b/api/internal/handler/storelink/getaispecshandler.go new file mode 100644 index 00000000..8e97d294 --- /dev/null +++ b/api/internal/handler/storelink/getaispecshandler.go @@ -0,0 +1,28 @@ +package storelink + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetAISpecsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetResourceSpecsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storelink.NewGetAISpecsLogic(r.Context(), svcCtx) + resp, err := l.GetAISpecs(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storelink/getlinkimagelisthandler.go b/api/internal/handler/storelink/getlinkimagelisthandler.go new file mode 100644 index 00000000..b83198f6 --- /dev/null +++ b/api/internal/handler/storelink/getlinkimagelisthandler.go @@ -0,0 +1,28 @@ +package storelink + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetLinkImageListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetLinkImageListReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storelink.NewGetLinkImageListLogic(r.Context(), svcCtx) + resp, err := l.GetLinkImageList(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storelink/getlinktaskhandler.go b/api/internal/handler/storelink/getlinktaskhandler.go new file mode 100644 index 00000000..af477e23 --- /dev/null +++ b/api/internal/handler/storelink/getlinktaskhandler.go @@ -0,0 +1,28 @@ +package storelink + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetLinkTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetLinkTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storelink.NewGetLinkTaskLogic(r.Context(), svcCtx) + resp, err := l.GetLinkTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storelink/getparticipantshandler.go b/api/internal/handler/storelink/getparticipantshandler.go new file mode 100644 index 00000000..07c88f83 --- /dev/null +++ b/api/internal/handler/storelink/getparticipantshandler.go @@ -0,0 +1,28 @@ +package storelink + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetParticipantsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetParticipantsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storelink.NewGetParticipantsLogic(r.Context(), svcCtx) + resp, err := l.GetParticipants(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storelink/submitlinktaskhandler.go b/api/internal/handler/storelink/submitlinktaskhandler.go new file mode 100644 index 00000000..5da13f4b --- /dev/null +++ b/api/internal/handler/storelink/submitlinktaskhandler.go @@ -0,0 +1,28 @@ +package storelink + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func SubmitLinkTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.SubmitLinkTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storelink.NewSubmitLinkTaskLogic(r.Context(), svcCtx) + resp, err := l.SubmitLinkTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storelink/uploadlinkimagehandler.go b/api/internal/handler/storelink/uploadlinkimagehandler.go new file mode 100644 index 00000000..9adec263 --- /dev/null +++ b/api/internal/handler/storelink/uploadlinkimagehandler.go @@ -0,0 +1,28 @@ +package storelink + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UploadLinkImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UploadLinkImageReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storelink.NewUploadLinkImageLogic(r.Context(), svcCtx) + resp, err := l.UploadLinkImage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/addsecuritygrouptoserverhandler.go b/api/internal/handler/vm/addsecuritygrouptoserverhandler.go new file mode 100644 index 00000000..86553cbf --- /dev/null +++ b/api/internal/handler/vm/addsecuritygrouptoserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func AddSecurityGroupToServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AddSecurityGroupToServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewAddSecurityGroupToServerLogic(r.Context(), svcCtx) + resp, err := l.AddSecurityGroupToServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/bulkcreatenetworkshandler.go b/api/internal/handler/vm/bulkcreatenetworkshandler.go new file mode 100644 index 00000000..84cad5c6 --- /dev/null +++ b/api/internal/handler/vm/bulkcreatenetworkshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func BulkCreateNetworksHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.BulkCreateNetworksReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewBulkCreateNetworksLogic(r.Context(), svcCtx) + resp, err := l.BulkCreateNetworks(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/changeadministrativepasswordhandler.go b/api/internal/handler/vm/changeadministrativepasswordhandler.go new file mode 100644 index 00000000..ecf1c6bc --- /dev/null +++ b/api/internal/handler/vm/changeadministrativepasswordhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ChangeAdministrativePasswordHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ChangeAdministrativePasswordReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewChangeAdministrativePasswordLogic(r.Context(), svcCtx) + resp, err := l.ChangeAdministrativePassword(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createfirewallgrouphandler.go b/api/internal/handler/vm/createfirewallgrouphandler.go new file mode 100644 index 00000000..f6f5b3a1 --- /dev/null +++ b/api/internal/handler/vm/createfirewallgrouphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateFirewallGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateFirewallGroupReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateFirewallGroupLogic(r.Context(), svcCtx) + resp, err := l.CreateFirewallGroup(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createfirewallpolicyhandler.go b/api/internal/handler/vm/createfirewallpolicyhandler.go new file mode 100644 index 00000000..77d8d1cf --- /dev/null +++ b/api/internal/handler/vm/createfirewallpolicyhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateFirewallPolicyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateFirewallPolicyReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateFirewallPolicyLogic(r.Context(), svcCtx) + resp, err := l.CreateFirewallPolicy(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createfirewallrulehandler.go b/api/internal/handler/vm/createfirewallrulehandler.go new file mode 100644 index 00000000..3995c08a --- /dev/null +++ b/api/internal/handler/vm/createfirewallrulehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateFirewallRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateFirewallRuleReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateFirewallRuleLogic(r.Context(), svcCtx) + resp, err := l.CreateFirewallRule(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createflavorhandler.go b/api/internal/handler/vm/createflavorhandler.go new file mode 100644 index 00000000..f32dc8f2 --- /dev/null +++ b/api/internal/handler/vm/createflavorhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateFlavorHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateFlavorReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateFlavorLogic(r.Context(), svcCtx) + resp, err := l.CreateFlavor(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createfloatingiphandler.go b/api/internal/handler/vm/createfloatingiphandler.go new file mode 100644 index 00000000..797a4a55 --- /dev/null +++ b/api/internal/handler/vm/createfloatingiphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateFloatingIPHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateFloatingIPReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateFloatingIPLogic(r.Context(), svcCtx) + resp, err := l.CreateFloatingIP(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createimagehandler.go b/api/internal/handler/vm/createimagehandler.go new file mode 100644 index 00000000..5f5e4f81 --- /dev/null +++ b/api/internal/handler/vm/createimagehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateImageReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateImageLogic(r.Context(), svcCtx) + resp, err := l.CreateImage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createnetworkhandler.go b/api/internal/handler/vm/createnetworkhandler.go new file mode 100644 index 00000000..2da207be --- /dev/null +++ b/api/internal/handler/vm/createnetworkhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateNetworkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateNetworkReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateNetworkLogic(r.Context(), svcCtx) + resp, err := l.CreateNetwork(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createnetworksegmentrangehandler.go b/api/internal/handler/vm/createnetworksegmentrangehandler.go new file mode 100644 index 00000000..47f7e5fa --- /dev/null +++ b/api/internal/handler/vm/createnetworksegmentrangehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateNetworkSegmentRangeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateNetworkSegmentRangeReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateNetworkSegmentRangeLogic(r.Context(), svcCtx) + resp, err := l.CreateNetworkSegmentRange(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createnodehandler.go b/api/internal/handler/vm/createnodehandler.go new file mode 100644 index 00000000..5df9dd56 --- /dev/null +++ b/api/internal/handler/vm/createnodehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateNodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateNodeReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateNodeLogic(r.Context(), svcCtx) + resp, err := l.CreateNode(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createporthandler.go b/api/internal/handler/vm/createporthandler.go new file mode 100644 index 00000000..0ea408b7 --- /dev/null +++ b/api/internal/handler/vm/createporthandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreatePortHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreatePortReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreatePortLogic(r.Context(), svcCtx) + resp, err := l.CreatePort(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createrouterhandler.go b/api/internal/handler/vm/createrouterhandler.go new file mode 100644 index 00000000..45390b39 --- /dev/null +++ b/api/internal/handler/vm/createrouterhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateRouterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateRouterReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateRouterLogic(r.Context(), svcCtx) + resp, err := l.CreateRouter(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createsecuritygrouphandler.go b/api/internal/handler/vm/createsecuritygrouphandler.go new file mode 100644 index 00000000..2fcfd935 --- /dev/null +++ b/api/internal/handler/vm/createsecuritygrouphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateSecurityGroupReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateSecurityGroupLogic(r.Context(), svcCtx) + resp, err := l.CreateSecurityGroup(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createsecuritygrouprulehandler.go b/api/internal/handler/vm/createsecuritygrouprulehandler.go new file mode 100644 index 00000000..11ffe7ea --- /dev/null +++ b/api/internal/handler/vm/createsecuritygrouprulehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateSecurityGroupRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateSecurityGroupRuleReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateSecurityGroupRuleLogic(r.Context(), svcCtx) + resp, err := l.CreateSecurityGroupRule(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createserverhandler.go b/api/internal/handler/vm/createserverhandler.go new file mode 100644 index 00000000..1afd92f1 --- /dev/null +++ b/api/internal/handler/vm/createserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateServerLogic(r.Context(), svcCtx) + resp, err := l.CreateServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createsubnethandler.go b/api/internal/handler/vm/createsubnethandler.go new file mode 100644 index 00000000..931121f3 --- /dev/null +++ b/api/internal/handler/vm/createsubnethandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateSubnetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateSubnetReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateSubnetLogic(r.Context(), svcCtx) + resp, err := l.CreateSubnet(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createvolumehandler.go b/api/internal/handler/vm/createvolumehandler.go new file mode 100644 index 00000000..4e6c56b3 --- /dev/null +++ b/api/internal/handler/vm/createvolumehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateVolumeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateVolumeReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateVolumeLogic(r.Context(), svcCtx) + resp, err := l.CreateVolume(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createvolumetypeshandler.go b/api/internal/handler/vm/createvolumetypeshandler.go new file mode 100644 index 00000000..955b889f --- /dev/null +++ b/api/internal/handler/vm/createvolumetypeshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateVolumeTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateVolumeTypeReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateVolumeTypesLogic(r.Context(), svcCtx) + resp, err := l.CreateVolumeTypes(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletefirewallgrouphandler.go b/api/internal/handler/vm/deletefirewallgrouphandler.go new file mode 100644 index 00000000..240f1ceb --- /dev/null +++ b/api/internal/handler/vm/deletefirewallgrouphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteFirewallGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteFirewallGroupReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteFirewallGroupLogic(r.Context(), svcCtx) + resp, err := l.DeleteFirewallGroup(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletefirewallpolicyhandler.go b/api/internal/handler/vm/deletefirewallpolicyhandler.go new file mode 100644 index 00000000..ee0f12fa --- /dev/null +++ b/api/internal/handler/vm/deletefirewallpolicyhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteFirewallPolicyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteFirewallPolicyReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteFirewallPolicyLogic(r.Context(), svcCtx) + resp, err := l.DeleteFirewallPolicy(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletefirewallrulehandler.go b/api/internal/handler/vm/deletefirewallrulehandler.go new file mode 100644 index 00000000..44c60272 --- /dev/null +++ b/api/internal/handler/vm/deletefirewallrulehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteFirewallRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteFirewallRuleReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteFirewallRuleLogic(r.Context(), svcCtx) + resp, err := l.DeleteFirewallRule(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deleteflavorhandler.go b/api/internal/handler/vm/deleteflavorhandler.go new file mode 100644 index 00000000..7bf5fe04 --- /dev/null +++ b/api/internal/handler/vm/deleteflavorhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteFlavorHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteFlavorReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteFlavorLogic(r.Context(), svcCtx) + resp, err := l.DeleteFlavor(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletefloatingiphandler.go b/api/internal/handler/vm/deletefloatingiphandler.go new file mode 100644 index 00000000..3f7abdf3 --- /dev/null +++ b/api/internal/handler/vm/deletefloatingiphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteFloatingIPHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteFloatingIPReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteFloatingIPLogic(r.Context(), svcCtx) + resp, err := l.DeleteFloatingIP(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deleteimagehandler.go b/api/internal/handler/vm/deleteimagehandler.go new file mode 100644 index 00000000..6ba84ce0 --- /dev/null +++ b/api/internal/handler/vm/deleteimagehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteImageReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteImageLogic(r.Context(), svcCtx) + resp, err := l.DeleteImage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletenetworkhandler.go b/api/internal/handler/vm/deletenetworkhandler.go new file mode 100644 index 00000000..182f3747 --- /dev/null +++ b/api/internal/handler/vm/deletenetworkhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteNetworkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteNetworkReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteNetworkLogic(r.Context(), svcCtx) + resp, err := l.DeleteNetwork(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletenetworksegmentrangeshandler.go b/api/internal/handler/vm/deletenetworksegmentrangeshandler.go new file mode 100644 index 00000000..b4cfc237 --- /dev/null +++ b/api/internal/handler/vm/deletenetworksegmentrangeshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteNetworkSegmentRangesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteNetworkSegmentRangesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteNetworkSegmentRangesLogic(r.Context(), svcCtx) + resp, err := l.DeleteNetworkSegmentRanges(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletenodehandler.go b/api/internal/handler/vm/deletenodehandler.go new file mode 100644 index 00000000..19f67962 --- /dev/null +++ b/api/internal/handler/vm/deletenodehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteNodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteNodeReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteNodeLogic(r.Context(), svcCtx) + resp, err := l.DeleteNode(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deleteporthandler.go b/api/internal/handler/vm/deleteporthandler.go new file mode 100644 index 00000000..45d4a17a --- /dev/null +++ b/api/internal/handler/vm/deleteporthandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeletePortHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeletePortReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeletePortLogic(r.Context(), svcCtx) + resp, err := l.DeletePort(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deleterouterhandler.go b/api/internal/handler/vm/deleterouterhandler.go new file mode 100644 index 00000000..0184dbed --- /dev/null +++ b/api/internal/handler/vm/deleterouterhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteRouterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteRouterReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteRouterLogic(r.Context(), svcCtx) + resp, err := l.DeleteRouter(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletesecuritygrouphandler.go b/api/internal/handler/vm/deletesecuritygrouphandler.go new file mode 100644 index 00000000..482ba147 --- /dev/null +++ b/api/internal/handler/vm/deletesecuritygrouphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteSecurityGroupReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteSecurityGroupLogic(r.Context(), svcCtx) + resp, err := l.DeleteSecurityGroup(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletesecuritygrouprulehandler.go b/api/internal/handler/vm/deletesecuritygrouprulehandler.go new file mode 100644 index 00000000..5dcf49cf --- /dev/null +++ b/api/internal/handler/vm/deletesecuritygrouprulehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteSecurityGroupRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteSecurityGroupRuleReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteSecurityGroupRuleLogic(r.Context(), svcCtx) + resp, err := l.DeleteSecurityGroupRule(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deleteserverhandler.go b/api/internal/handler/vm/deleteserverhandler.go new file mode 100644 index 00000000..412ee0a4 --- /dev/null +++ b/api/internal/handler/vm/deleteserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteServerLogic(r.Context(), svcCtx) + resp, err := l.DeleteServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletesubnethandler.go b/api/internal/handler/vm/deletesubnethandler.go new file mode 100644 index 00000000..cb8e0b40 --- /dev/null +++ b/api/internal/handler/vm/deletesubnethandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteSubnetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteSubnetReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteSubnetLogic(r.Context(), svcCtx) + resp, err := l.DeleteSubnet(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletevolumehandler.go b/api/internal/handler/vm/deletevolumehandler.go new file mode 100644 index 00000000..d7e91490 --- /dev/null +++ b/api/internal/handler/vm/deletevolumehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteVolumeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteVolumeReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteVolumeLogic(r.Context(), svcCtx) + resp, err := l.DeleteVolume(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletevolumetypehandler.go b/api/internal/handler/vm/deletevolumetypehandler.go new file mode 100644 index 00000000..6467de46 --- /dev/null +++ b/api/internal/handler/vm/deletevolumetypehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteVolumeTypeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteVolumeTypeReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteVolumeTypeLogic(r.Context(), svcCtx) + resp, err := l.DeleteVolumeType(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/getcomputelimitshandler.go b/api/internal/handler/vm/getcomputelimitshandler.go new file mode 100644 index 00000000..e52d0fb9 --- /dev/null +++ b/api/internal/handler/vm/getcomputelimitshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetComputeLimitsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetComputeLimitsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewGetComputeLimitsLogic(r.Context(), svcCtx) + resp, err := l.GetComputeLimits(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/getimagenumhandler.go b/api/internal/handler/vm/getimagenumhandler.go new file mode 100644 index 00000000..ecaf4ea1 --- /dev/null +++ b/api/internal/handler/vm/getimagenumhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetImageNumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListImagesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewGetImageNumLogic(r.Context(), svcCtx) + resp, err := l.GetImageNum(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/getnetworknumhandler.go b/api/internal/handler/vm/getnetworknumhandler.go new file mode 100644 index 00000000..d1115cdf --- /dev/null +++ b/api/internal/handler/vm/getnetworknumhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetNetworkNumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListNetworksReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewGetNetworkNumLogic(r.Context(), svcCtx) + resp, err := l.GetNetworkNum(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/getserversdetailedbyidhandler.go b/api/internal/handler/vm/getserversdetailedbyidhandler.go new file mode 100644 index 00000000..884d5412 --- /dev/null +++ b/api/internal/handler/vm/getserversdetailedbyidhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetServersDetailedByIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetServersDetailedByIdReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewGetServersDetailedByIdLogic(r.Context(), svcCtx) + resp, err := l.GetServersDetailedById(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/getvolumedetailedbyidhandler.go b/api/internal/handler/vm/getvolumedetailedbyidhandler.go new file mode 100644 index 00000000..fa08be98 --- /dev/null +++ b/api/internal/handler/vm/getvolumedetailedbyidhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetVolumeDetailedByIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetVolumeDetailedByIdReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewGetVolumeDetailedByIdLogic(r.Context(), svcCtx) + resp, err := l.GetVolumeDetailedById(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/getvolumelimitshandler.go b/api/internal/handler/vm/getvolumelimitshandler.go new file mode 100644 index 00000000..07e9af2d --- /dev/null +++ b/api/internal/handler/vm/getvolumelimitshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetVolumeLimitsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetVolumeLimitsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewGetVolumeLimitsLogic(r.Context(), svcCtx) + resp, err := l.GetVolumeLimits(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listfirewallgroupshandler.go b/api/internal/handler/vm/listfirewallgroupshandler.go new file mode 100644 index 00000000..01041333 --- /dev/null +++ b/api/internal/handler/vm/listfirewallgroupshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListFirewallGroupsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListFirewallGroupsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListFirewallGroupsLogic(r.Context(), svcCtx) + resp, err := l.ListFirewallGroups(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listfirewallpolicieshandler.go b/api/internal/handler/vm/listfirewallpolicieshandler.go new file mode 100644 index 00000000..877c2806 --- /dev/null +++ b/api/internal/handler/vm/listfirewallpolicieshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListFirewallPoliciesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListFirewallPoliciesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListFirewallPoliciesLogic(r.Context(), svcCtx) + resp, err := l.ListFirewallPolicies(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listfirewallruleshandler.go b/api/internal/handler/vm/listfirewallruleshandler.go new file mode 100644 index 00000000..b630593c --- /dev/null +++ b/api/internal/handler/vm/listfirewallruleshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListFirewallRulesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListFirewallRulesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListFirewallRulesLogic(r.Context(), svcCtx) + resp, err := l.ListFirewallRules(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listflavorsdetailhandler.go b/api/internal/handler/vm/listflavorsdetailhandler.go new file mode 100644 index 00000000..09362f69 --- /dev/null +++ b/api/internal/handler/vm/listflavorsdetailhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListFlavorsDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListFlavorsDetailReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListFlavorsDetailLogic(r.Context(), svcCtx) + resp, err := l.ListFlavorsDetail(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listfloatingipshandler.go b/api/internal/handler/vm/listfloatingipshandler.go new file mode 100644 index 00000000..f723634c --- /dev/null +++ b/api/internal/handler/vm/listfloatingipshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListFloatingIPsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListFloatingIPsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListFloatingIPsLogic(r.Context(), svcCtx) + resp, err := l.ListFloatingIPs(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listimageshandler.go b/api/internal/handler/vm/listimageshandler.go new file mode 100644 index 00000000..cf5844cb --- /dev/null +++ b/api/internal/handler/vm/listimageshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListImagesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListImagesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListImagesLogic(r.Context(), svcCtx) + resp, err := l.ListImages(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listnetworksegmentrangesrangehandler.go b/api/internal/handler/vm/listnetworksegmentrangesrangehandler.go new file mode 100644 index 00000000..27b3478f --- /dev/null +++ b/api/internal/handler/vm/listnetworksegmentrangesrangehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListNetworkSegmentRangesRangeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListNetworkSegmentRangesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListNetworkSegmentRangesRangeLogic(r.Context(), svcCtx) + resp, err := l.ListNetworkSegmentRangesRange(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listnetworkshandler.go b/api/internal/handler/vm/listnetworkshandler.go new file mode 100644 index 00000000..c7078abf --- /dev/null +++ b/api/internal/handler/vm/listnetworkshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListNetworksHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListNetworksReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListNetworksLogic(r.Context(), svcCtx) + resp, err := l.ListNetworks(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listnodeshandler.go b/api/internal/handler/vm/listnodeshandler.go new file mode 100644 index 00000000..fcc192d2 --- /dev/null +++ b/api/internal/handler/vm/listnodeshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListNodesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListNodesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListNodesLogic(r.Context(), svcCtx) + resp, err := l.ListNodes(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listportshandler.go b/api/internal/handler/vm/listportshandler.go new file mode 100644 index 00000000..ac134170 --- /dev/null +++ b/api/internal/handler/vm/listportshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListPortsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListPortsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListPortsLogic(r.Context(), svcCtx) + resp, err := l.ListPorts(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listroutershandler.go b/api/internal/handler/vm/listroutershandler.go new file mode 100644 index 00000000..e7b6bc11 --- /dev/null +++ b/api/internal/handler/vm/listroutershandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListRoutersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListRoutersReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListRoutersLogic(r.Context(), svcCtx) + resp, err := l.ListRouters(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listsecuritygroupruleshandler.go b/api/internal/handler/vm/listsecuritygroupruleshandler.go new file mode 100644 index 00000000..2b31f7e8 --- /dev/null +++ b/api/internal/handler/vm/listsecuritygroupruleshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListSecurityGroupRulesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListSecurityGroupRulesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListSecurityGroupRulesLogic(r.Context(), svcCtx) + resp, err := l.ListSecurityGroupRules(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listsecuritygroupshandler.go b/api/internal/handler/vm/listsecuritygroupshandler.go new file mode 100644 index 00000000..be559d8d --- /dev/null +++ b/api/internal/handler/vm/listsecuritygroupshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListSecurityGroupsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListSecurityGroupsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListSecurityGroupsLogic(r.Context(), svcCtx) + resp, err := l.ListSecurityGroups(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listserverhandler.go b/api/internal/handler/vm/listserverhandler.go new file mode 100644 index 00000000..4c859136 --- /dev/null +++ b/api/internal/handler/vm/listserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListServersReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListServerLogic(r.Context(), svcCtx) + resp, err := l.ListServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listserversdetailedhandler.go b/api/internal/handler/vm/listserversdetailedhandler.go new file mode 100644 index 00000000..1dc3daaf --- /dev/null +++ b/api/internal/handler/vm/listserversdetailedhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListServersDetailedHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListServersDetailedReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListServersDetailedLogic(r.Context(), svcCtx) + resp, err := l.ListServersDetailed(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listsubnetshandler.go b/api/internal/handler/vm/listsubnetshandler.go new file mode 100644 index 00000000..a148ccc5 --- /dev/null +++ b/api/internal/handler/vm/listsubnetshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListSubnetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListSubnetsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListSubnetsLogic(r.Context(), svcCtx) + resp, err := l.ListSubnets(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listvolumesdetailhandler.go b/api/internal/handler/vm/listvolumesdetailhandler.go new file mode 100644 index 00000000..fd0e6bb2 --- /dev/null +++ b/api/internal/handler/vm/listvolumesdetailhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListVolumesDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListVolumesDetailReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListVolumesDetailLogic(r.Context(), svcCtx) + resp, err := l.ListVolumesDetail(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listvolumeshandler.go b/api/internal/handler/vm/listvolumeshandler.go new file mode 100644 index 00000000..330fc958 --- /dev/null +++ b/api/internal/handler/vm/listvolumeshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListVolumesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListVolumesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListVolumesLogic(r.Context(), svcCtx) + resp, err := l.ListVolumes(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listvolumetypeshandler.go b/api/internal/handler/vm/listvolumetypeshandler.go new file mode 100644 index 00000000..711a2f75 --- /dev/null +++ b/api/internal/handler/vm/listvolumetypeshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListVolumeTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListVolumeTypesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListVolumeTypesLogic(r.Context(), svcCtx) + resp, err := l.ListVolumeTypes(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/migrateserverhandler.go b/api/internal/handler/vm/migrateserverhandler.go new file mode 100644 index 00000000..2a7dbe82 --- /dev/null +++ b/api/internal/handler/vm/migrateserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func MigrateServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.MigrateServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewMigrateServerLogic(r.Context(), svcCtx) + resp, err := l.MigrateServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/pauseserverhandler.go b/api/internal/handler/vm/pauseserverhandler.go new file mode 100644 index 00000000..610c4193 --- /dev/null +++ b/api/internal/handler/vm/pauseserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func PauseServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.PauseServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewPauseServerLogic(r.Context(), svcCtx) + resp, err := l.PauseServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/rebootserverhandler.go b/api/internal/handler/vm/rebootserverhandler.go new file mode 100644 index 00000000..31da26be --- /dev/null +++ b/api/internal/handler/vm/rebootserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func RebootServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.RebootServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewRebootServerLogic(r.Context(), svcCtx) + resp, err := l.RebootServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/removesecuritygrouphandler.go b/api/internal/handler/vm/removesecuritygrouphandler.go new file mode 100644 index 00000000..40b21349 --- /dev/null +++ b/api/internal/handler/vm/removesecuritygrouphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func RemoveSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.RemoveSecurityGroupReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewRemoveSecurityGroupLogic(r.Context(), svcCtx) + resp, err := l.RemoveSecurityGroup(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/rescueserverhandler.go b/api/internal/handler/vm/rescueserverhandler.go new file mode 100644 index 00000000..97c18bd2 --- /dev/null +++ b/api/internal/handler/vm/rescueserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func RescueServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.RescueServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewRescueServerLogic(r.Context(), svcCtx) + resp, err := l.RescueServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/resizeserverhandler.go b/api/internal/handler/vm/resizeserverhandler.go new file mode 100644 index 00000000..81d8be1e --- /dev/null +++ b/api/internal/handler/vm/resizeserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ResizeServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ResizeServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewResizeServerLogic(r.Context(), svcCtx) + resp, err := l.ResizeServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/shelveserverhandler.go b/api/internal/handler/vm/shelveserverhandler.go new file mode 100644 index 00000000..927c78c3 --- /dev/null +++ b/api/internal/handler/vm/shelveserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShelveServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShelveServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShelveServerLogic(r.Context(), svcCtx) + resp, err := l.ShelveServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/showfirewallgroupdetailshandler.go b/api/internal/handler/vm/showfirewallgroupdetailshandler.go new file mode 100644 index 00000000..6e1e07ae --- /dev/null +++ b/api/internal/handler/vm/showfirewallgroupdetailshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowFirewallGroupDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowFirewallGroupDetailsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowFirewallGroupDetailsLogic(r.Context(), svcCtx) + resp, err := l.ShowFirewallGroupDetails(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/showfirewallpolicydetailshandler.go b/api/internal/handler/vm/showfirewallpolicydetailshandler.go new file mode 100644 index 00000000..1b562893 --- /dev/null +++ b/api/internal/handler/vm/showfirewallpolicydetailshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowFirewallPolicyDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowFirewallPolicyDetailsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowFirewallPolicyDetailsLogic(r.Context(), svcCtx) + resp, err := l.ShowFirewallPolicyDetails(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/showfirewallruledetailshandler.go b/api/internal/handler/vm/showfirewallruledetailshandler.go new file mode 100644 index 00000000..b026c434 --- /dev/null +++ b/api/internal/handler/vm/showfirewallruledetailshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowFirewallRuleDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowFirewallRuleDetailsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowFirewallRuleDetailsLogic(r.Context(), svcCtx) + resp, err := l.ShowFirewallRuleDetails(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/showfloatingipdetailshandler.go b/api/internal/handler/vm/showfloatingipdetailshandler.go new file mode 100644 index 00000000..91e09a44 --- /dev/null +++ b/api/internal/handler/vm/showfloatingipdetailshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowFloatingIPDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowFloatingIPDetailsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowFloatingIPDetailsLogic(r.Context(), svcCtx) + resp, err := l.ShowFloatingIPDetails(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/shownetworkdetailshandler.go b/api/internal/handler/vm/shownetworkdetailshandler.go new file mode 100644 index 00000000..113a0e7e --- /dev/null +++ b/api/internal/handler/vm/shownetworkdetailshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowNetworkDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowNetworkDetailsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowNetworkDetailsLogic(r.Context(), svcCtx) + resp, err := l.ShowNetworkDetails(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/shownetworksegmentrangedetailshandler.go b/api/internal/handler/vm/shownetworksegmentrangedetailshandler.go new file mode 100644 index 00000000..309c7533 --- /dev/null +++ b/api/internal/handler/vm/shownetworksegmentrangedetailshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowNetworkSegmentRangeDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowNetworkSegmentRangeDetailsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowNetworkSegmentRangeDetailsLogic(r.Context(), svcCtx) + resp, err := l.ShowNetworkSegmentRangeDetails(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/shownodedetailshandler.go b/api/internal/handler/vm/shownodedetailshandler.go new file mode 100644 index 00000000..1a025f73 --- /dev/null +++ b/api/internal/handler/vm/shownodedetailshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowNodeDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowNodeDetailsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowNodeDetailsLogic(r.Context(), svcCtx) + resp, err := l.ShowNodeDetails(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/showportdetailshandler.go b/api/internal/handler/vm/showportdetailshandler.go new file mode 100644 index 00000000..2066679e --- /dev/null +++ b/api/internal/handler/vm/showportdetailshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowPortDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowPortDetailsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowPortDetailsLogic(r.Context(), svcCtx) + resp, err := l.ShowPortDetails(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/showrouterdetailshandler.go b/api/internal/handler/vm/showrouterdetailshandler.go new file mode 100644 index 00000000..395e03d2 --- /dev/null +++ b/api/internal/handler/vm/showrouterdetailshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowRouterDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowRouterDetailsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowRouterDetailsLogic(r.Context(), svcCtx) + resp, err := l.ShowRouterDetails(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/showsecuritygrouphandler.go b/api/internal/handler/vm/showsecuritygrouphandler.go new file mode 100644 index 00000000..0cf2ecfa --- /dev/null +++ b/api/internal/handler/vm/showsecuritygrouphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowSecurityGroupReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowSecurityGroupLogic(r.Context(), svcCtx) + resp, err := l.ShowSecurityGroup(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/showsecuritygrouprulehandler.go b/api/internal/handler/vm/showsecuritygrouprulehandler.go new file mode 100644 index 00000000..3dcdc0ed --- /dev/null +++ b/api/internal/handler/vm/showsecuritygrouprulehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowSecurityGroupRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowSecurityGroupRuleReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowSecurityGroupRuleLogic(r.Context(), svcCtx) + resp, err := l.ShowSecurityGroupRule(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/startserverhandler.go b/api/internal/handler/vm/startserverhandler.go new file mode 100644 index 00000000..00fc4257 --- /dev/null +++ b/api/internal/handler/vm/startserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func StartServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.StartServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewStartServerLogic(r.Context(), svcCtx) + resp, err := l.StartServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/stopserverhandler.go b/api/internal/handler/vm/stopserverhandler.go new file mode 100644 index 00000000..1941ade0 --- /dev/null +++ b/api/internal/handler/vm/stopserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func StopServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.StopServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewStopServerLogic(r.Context(), svcCtx) + resp, err := l.StopServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/suspendserverhandler.go b/api/internal/handler/vm/suspendserverhandler.go new file mode 100644 index 00000000..fd9826e8 --- /dev/null +++ b/api/internal/handler/vm/suspendserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func SuspendServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.SuspendServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewSuspendServerLogic(r.Context(), svcCtx) + resp, err := l.SuspendServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/unpauseserverhandler.go b/api/internal/handler/vm/unpauseserverhandler.go new file mode 100644 index 00000000..3095d1e8 --- /dev/null +++ b/api/internal/handler/vm/unpauseserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UnpauseServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UnpauseServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUnpauseServerLogic(r.Context(), svcCtx) + resp, err := l.UnpauseServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/unrescuehandler.go b/api/internal/handler/vm/unrescuehandler.go new file mode 100644 index 00000000..e07adec8 --- /dev/null +++ b/api/internal/handler/vm/unrescuehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UnRescueHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UnRescueServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUnRescueLogic(r.Context(), svcCtx) + resp, err := l.UnRescue(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updatefirewallgrouphandler.go b/api/internal/handler/vm/updatefirewallgrouphandler.go new file mode 100644 index 00000000..1d072d0b --- /dev/null +++ b/api/internal/handler/vm/updatefirewallgrouphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateFirewallGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateFirewallGroupReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdateFirewallGroupLogic(r.Context(), svcCtx) + resp, err := l.UpdateFirewallGroup(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updatefloatingiphandler.go b/api/internal/handler/vm/updatefloatingiphandler.go new file mode 100644 index 00000000..16493a84 --- /dev/null +++ b/api/internal/handler/vm/updatefloatingiphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateFloatingIPHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateFloatingIPReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdateFloatingIPLogic(r.Context(), svcCtx) + resp, err := l.UpdateFloatingIP(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updatenetworkhandler.go b/api/internal/handler/vm/updatenetworkhandler.go new file mode 100644 index 00000000..fc1b3a0c --- /dev/null +++ b/api/internal/handler/vm/updatenetworkhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateNetworkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateNetworkReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdateNetworkLogic(r.Context(), svcCtx) + resp, err := l.UpdateNetwork(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updatenetworksegmentrangeshandler.go b/api/internal/handler/vm/updatenetworksegmentrangeshandler.go new file mode 100644 index 00000000..c91e38eb --- /dev/null +++ b/api/internal/handler/vm/updatenetworksegmentrangeshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateNetworkSegmentRangesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateNetworkSegmentRangesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdateNetworkSegmentRangesLogic(r.Context(), svcCtx) + resp, err := l.UpdateNetworkSegmentRanges(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updateporthandler.go b/api/internal/handler/vm/updateporthandler.go new file mode 100644 index 00000000..37e34376 --- /dev/null +++ b/api/internal/handler/vm/updateporthandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdatePortHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdatePortReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdatePortLogic(r.Context(), svcCtx) + resp, err := l.UpdatePort(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updaterouterhandler.go b/api/internal/handler/vm/updaterouterhandler.go new file mode 100644 index 00000000..262ee32a --- /dev/null +++ b/api/internal/handler/vm/updaterouterhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateRouterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateRouterReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdateRouterLogic(r.Context(), svcCtx) + resp, err := l.UpdateRouter(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updatesecuritygrouphandler.go b/api/internal/handler/vm/updatesecuritygrouphandler.go new file mode 100644 index 00000000..2d0d5de2 --- /dev/null +++ b/api/internal/handler/vm/updatesecuritygrouphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateSecurityGroupReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdateSecurityGroupLogic(r.Context(), svcCtx) + resp, err := l.UpdateSecurityGroup(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updateserverhandler.go b/api/internal/handler/vm/updateserverhandler.go new file mode 100644 index 00000000..acd162a4 --- /dev/null +++ b/api/internal/handler/vm/updateserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdateServerLogic(r.Context(), svcCtx) + resp, err := l.UpdateServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updatesubnethandler.go b/api/internal/handler/vm/updatesubnethandler.go new file mode 100644 index 00000000..a8093754 --- /dev/null +++ b/api/internal/handler/vm/updatesubnethandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateSubnetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateSubnetReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdateSubnetLogic(r.Context(), svcCtx) + resp, err := l.UpdateSubnet(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updatevolumehandler.go b/api/internal/handler/vm/updatevolumehandler.go new file mode 100644 index 00000000..80389014 --- /dev/null +++ b/api/internal/handler/vm/updatevolumehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateVolumeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateVolumeReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdateVolumeLogic(r.Context(), svcCtx) + resp, err := l.UpdateVolume(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/uploadimagehandler.go b/api/internal/handler/vm/uploadimagehandler.go new file mode 100644 index 00000000..0682d12f --- /dev/null +++ b/api/internal/handler/vm/uploadimagehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UploadImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UploadOsImageReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUploadImageLogic(r.Context(), svcCtx) + resp, err := l.UploadImage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} From fdee604568dd84fb76cbecd2739d849eea49d0f0 Mon Sep 17 00:00:00 2001 From: qiwang <1364512070@qq.com> Date: Mon, 25 Mar 2024 20:12:38 +0800 Subject: [PATCH 4/4] feat:Add field to create virtual machine Former-commit-id: 6d09c5b808904267920a670487aaa09ba191301c --- .../handler/core/scheduletaskbyyamlhandler.go | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/api/internal/handler/core/scheduletaskbyyamlhandler.go b/api/internal/handler/core/scheduletaskbyyamlhandler.go index 1841a389..c3447137 100644 --- a/api/internal/handler/core/scheduletaskbyyamlhandler.go +++ b/api/internal/handler/core/scheduletaskbyyamlhandler.go @@ -1,6 +1,8 @@ package core import ( + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils" "net/http" "github.com/zeromicro/go-zero/rest/httpx" @@ -13,16 +15,22 @@ func ScheduleTaskByYamlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ScheduleTaskByYamlReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.HttpResult(r, w, nil, err) return } - - l := core.NewScheduleTaskByYamlLogic(r.Context(), svcCtx) - err := l.ScheduleTaskByYaml(&req) + // 解析yaml文件 + _, fileHeader, err := r.FormFile("file") if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) + result.HttpResult(r, w, nil, err) + return } + err = utils.Yaml2struct(fileHeader, &req) + if err != nil { + result.HttpResult(r, w, nil, err) + return + } + l := core.NewScheduleTaskByYamlLogic(r.Context(), svcCtx) + resp, err := l.ScheduleTaskByYaml(&req) + result.HttpResult(r, w, resp, err) } }