| @@ -1,9 +1,8 @@ | |||||
| pcm-core-api: | |||||
| CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-core-api api/pcm.go | |||||
| api-gen: | |||||
| goctl api go -api desc/pcm.api -dir . -style gozero --home ../deploy/goctl | |||||
| pcm-core-rpc: | |||||
| CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-core-rpc rpc/pcmcore.go | |||||
| Generate-AMD64: | |||||
| CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-coordinator-api pcm.go | |||||
| all-build: pcm-core-rpc pcm-core-api | |||||
| .PHONY: pcm-core-rpc pcm-core-api | |||||
| Generate-ARM64: | |||||
| CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOARM=7 go build -o pcm-coordinator-api pcm.go | |||||
| @@ -1,8 +0,0 @@ | |||||
| api-gen: | |||||
| goctl api go -api desc/pcm.api -dir . -style gozero --home ../deploy/goctl | |||||
| Generate-AMD64: | |||||
| CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pcm-coordinator-api pcm.go | |||||
| Generate-ARM64: | |||||
| CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOARM=7 go build -o pcm-coordinator-api pcm.go | |||||
| @@ -1,85 +0,0 @@ | |||||
| Name: pcm.core.api | |||||
| Host: 0.0.0.0 | |||||
| Port: 8999 | |||||
| MaxBytes: 524288000 | |||||
| Timeout: 50000 | |||||
| DB: | |||||
| DataSource: root:uJpLd6u-J?HC1@(10.206.0.12:3306)/pcm?parseTime=true&loc=Local | |||||
| # DataSource: root:uJpLd6u-J?HC1@(47.92.88.143:3306)/pcm?parseTime=true&loc=Local | |||||
| Redis: | |||||
| Host: 10.206.0.12:6379 | |||||
| Pass: redisPW123 | |||||
| Monitoring: | |||||
| PromUrl: http://47.92.39.128:30877 | |||||
| AlertUrl: 47.92.39.128:32243 | |||||
| #rpc | |||||
| THRpcConf: | |||||
| target: nacos://10.206.0.12:8848/pcm.th.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api | |||||
| # Endpoints: | |||||
| # - 127.0.0.1:8888 | |||||
| NonBlock: true | |||||
| #rpc | |||||
| ModelArtsRpcConf: | |||||
| # target: nacos://10.206.0.12:8848/pcm.modelarts.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api | |||||
| Endpoints: | |||||
| - 127.0.0.1:2002 | |||||
| NonBlock: true | |||||
| Timeout: 20000 | |||||
| #rpc | |||||
| ModelArtsImgRpcConf: | |||||
| target: nacos://10.206.0.12:8848/pcm.modelarts.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api | |||||
| # Endpoints: | |||||
| # - 127.0.0.1:2002 | |||||
| NonBlock: true | |||||
| #rpc | |||||
| ACRpcConf: | |||||
| target: nacos://10.206.0.12:8848/pcm.ac.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api | |||||
| # Endpoints: | |||||
| # - 127.0.0.1:8888 | |||||
| NonBlock: true | |||||
| Timeout: 50000 | |||||
| #rpc | |||||
| CephRpcConf: | |||||
| # target: nacos://10.206.0.12:8848/pcm.ceph.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api | |||||
| Endpoints: | |||||
| - pcm-participant-ceph-service:2008 | |||||
| NonBlock: true | |||||
| Timeout: 50000 | |||||
| OctopusRpcConf: | |||||
| target: nacos://10.206.0.12:8848/pcm.octopus.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api | |||||
| # Endpoints: | |||||
| # - 127.0.0.1:8888 | |||||
| NonBlock: true | |||||
| Timeout: 20000 | |||||
| OpenstackRpcConf: | |||||
| # target: nacos://10.206.0.12:8848/pcm.openstack.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api | |||||
| Endpoints: | |||||
| - 127.0.0.1:2010 | |||||
| NonBlock: true | |||||
| Timeout: 20000 | |||||
| # core rpc | |||||
| PcmCoreRpcConf: | |||||
| # target: nacos://10.206.0.12:8848/pcm.core.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api | |||||
| Endpoints: | |||||
| - pcm-core-rpc:2004 | |||||
| NonBlock: true | |||||
| Timeout: 20000 | |||||
| MinioConf: | |||||
| Secret: minio_xnu122@_ | |||||
| AccessKey: minioadmin | |||||
| Endpoint: http://121.89.220.60:9000 | |||||
| SnowflakeConf: | |||||
| MachineId: 1 | |||||
| @@ -1,250 +0,0 @@ | |||||
| package cron | |||||
| import ( | |||||
| "errors" | |||||
| "fmt" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| "github.com/zeromicro/go-zero/zrpc" | |||||
| hpcacclient "gitlink.org.cn/JointCloud/pcm-ac/hpcacclient" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/config" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/scheduler/service/collector" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/scheduler/service/executor" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/storeLink" | |||||
| "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/models" | |||||
| "gitlink.org.cn/JointCloud/pcm-modelarts/client/imagesservice" | |||||
| "gitlink.org.cn/JointCloud/pcm-modelarts/client/modelartsservice" | |||||
| "gitlink.org.cn/JointCloud/pcm-octopus/octopusclient" | |||||
| "net/http" | |||||
| "strconv" | |||||
| "sync" | |||||
| ) | |||||
| const ( | |||||
| OCTOPUS = "octopus" | |||||
| MODELARTS = "modelarts" | |||||
| SHUGUANGAI = "shuguangAi" | |||||
| ) | |||||
| func GetTaskList(svc *svc.ServiceContext) ([]*types.TaskModel, error) { | |||||
| limit := 10 | |||||
| offset := 0 | |||||
| var list []*types.TaskModel | |||||
| db := svc.DbEngin.Model(&types.TaskModel{}).Table("task") | |||||
| db = db.Where("deleted_at is null") | |||||
| //count total | |||||
| var total int64 | |||||
| err := db.Count(&total).Error | |||||
| db.Limit(limit).Offset(offset) | |||||
| if err != nil { | |||||
| return nil, err | |||||
| } | |||||
| err = db.Order("created_time desc").Find(&list).Error | |||||
| if err != nil { | |||||
| return nil, err | |||||
| } | |||||
| return list, nil | |||||
| } | |||||
| func UpdateAiAdapterMaps(svc *svc.ServiceContext) { | |||||
| var aiType = "1" | |||||
| adapterIds, err := svc.Scheduler.AiStorages.GetAdapterIdsByType(aiType) | |||||
| if err != nil { | |||||
| msg := fmt.Sprintf("###UpdateAiAdapterMaps###, error: %v \n", err.Error()) | |||||
| logx.Errorf(errors.New(msg).Error()) | |||||
| return | |||||
| } | |||||
| if len(adapterIds) == 0 { | |||||
| return | |||||
| } | |||||
| for _, id := range adapterIds { | |||||
| clusters, err := svc.Scheduler.AiStorages.GetClustersByAdapterId(id) | |||||
| if err != nil { | |||||
| msg := fmt.Sprintf("###UpdateAiAdapterMaps###, error: %v \n", err.Error()) | |||||
| logx.Errorf(errors.New(msg).Error()) | |||||
| return | |||||
| } | |||||
| if len(clusters.List) == 0 { | |||||
| continue | |||||
| } | |||||
| if isAdapterExist(svc, id, len(clusters.List)) { | |||||
| continue | |||||
| } else { | |||||
| if isAdapterEmpty(svc, id) { | |||||
| exeClusterMap, colClusterMap := InitAiClusterMap(&svc.Config, clusters.List) | |||||
| svc.Scheduler.AiService.AiExecutorAdapterMap[id] = exeClusterMap | |||||
| svc.Scheduler.AiService.AiCollectorAdapterMap[id] = colClusterMap | |||||
| } else { | |||||
| UpdateClusterMaps(svc, id, clusters.List) | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| func UpdateClusterMaps(svc *svc.ServiceContext, adapterId string, clusters []types.ClusterInfo) { | |||||
| for _, c := range clusters { | |||||
| _, ok := svc.Scheduler.AiService.AiExecutorAdapterMap[adapterId][c.Id] | |||||
| _, ok2 := svc.Scheduler.AiService.AiCollectorAdapterMap[adapterId][c.Id] | |||||
| if !ok && !ok2 { | |||||
| switch c.Name { | |||||
| case OCTOPUS: | |||||
| id, _ := strconv.ParseInt(c.Id, 10, 64) | |||||
| octopusRpc := octopusclient.NewOctopus(zrpc.MustNewClient(svc.Config.OctopusRpcConf)) | |||||
| octopus := storeLink.NewOctopusLink(octopusRpc, c.Nickname, id) | |||||
| svc.Scheduler.AiService.AiExecutorAdapterMap[adapterId][c.Id] = octopus | |||||
| svc.Scheduler.AiService.AiExecutorAdapterMap[adapterId][c.Id] = octopus | |||||
| case MODELARTS: | |||||
| id, _ := strconv.ParseInt(c.Id, 10, 64) | |||||
| modelArtsRpc := modelartsservice.NewModelArtsService(zrpc.MustNewClient(svc.Config.ModelArtsRpcConf)) | |||||
| modelArtsImgRpc := imagesservice.NewImagesService(zrpc.MustNewClient(svc.Config.ModelArtsImgRpcConf)) | |||||
| modelarts := storeLink.NewModelArtsLink(modelArtsRpc, modelArtsImgRpc, c.Name, id, c.Nickname) | |||||
| svc.Scheduler.AiService.AiExecutorAdapterMap[adapterId][c.Id] = modelarts | |||||
| svc.Scheduler.AiService.AiExecutorAdapterMap[adapterId][c.Id] = modelarts | |||||
| case SHUGUANGAI: | |||||
| id, _ := strconv.ParseInt(c.Id, 10, 64) | |||||
| aCRpc := hpcacclient.NewHpcAC(zrpc.MustNewClient(svc.Config.ACRpcConf)) | |||||
| sgai := storeLink.NewShuguangAi(aCRpc, c.Nickname, id) | |||||
| svc.Scheduler.AiService.AiExecutorAdapterMap[adapterId][c.Id] = sgai | |||||
| svc.Scheduler.AiService.AiExecutorAdapterMap[adapterId][c.Id] = sgai | |||||
| } | |||||
| } else { | |||||
| continue | |||||
| } | |||||
| } | |||||
| } | |||||
| func isAdapterExist(svc *svc.ServiceContext, id string, clusterNum int) bool { | |||||
| emap, ok := svc.Scheduler.AiService.AiExecutorAdapterMap[id] | |||||
| cmap, ok2 := svc.Scheduler.AiService.AiCollectorAdapterMap[id] | |||||
| if ok && ok2 { | |||||
| if len(emap) == clusterNum && len(cmap) == clusterNum { | |||||
| return true | |||||
| } | |||||
| } | |||||
| return false | |||||
| } | |||||
| func isAdapterEmpty(svc *svc.ServiceContext, id string) bool { | |||||
| _, ok := svc.Scheduler.AiService.AiExecutorAdapterMap[id] | |||||
| _, ok2 := svc.Scheduler.AiService.AiCollectorAdapterMap[id] | |||||
| if !ok && !ok2 { | |||||
| return true | |||||
| } | |||||
| return false | |||||
| } | |||||
| func InitAiClusterMap(conf *config.Config, clusters []types.ClusterInfo) (map[string]executor.AiExecutor, map[string]collector.AiCollector) { | |||||
| executorMap := make(map[string]executor.AiExecutor) | |||||
| collectorMap := make(map[string]collector.AiCollector) | |||||
| for _, c := range clusters { | |||||
| switch c.Name { | |||||
| case OCTOPUS: | |||||
| id, _ := strconv.ParseInt(c.Id, 10, 64) | |||||
| octopusRpc := octopusclient.NewOctopus(zrpc.MustNewClient(conf.OctopusRpcConf)) | |||||
| octopus := storeLink.NewOctopusLink(octopusRpc, c.Nickname, id) | |||||
| collectorMap[c.Id] = octopus | |||||
| executorMap[c.Id] = octopus | |||||
| case MODELARTS: | |||||
| id, _ := strconv.ParseInt(c.Id, 10, 64) | |||||
| modelArtsRpc := modelartsservice.NewModelArtsService(zrpc.MustNewClient(conf.ModelArtsRpcConf)) | |||||
| modelArtsImgRpc := imagesservice.NewImagesService(zrpc.MustNewClient(conf.ModelArtsImgRpcConf)) | |||||
| modelarts := storeLink.NewModelArtsLink(modelArtsRpc, modelArtsImgRpc, c.Name, id, c.Nickname) | |||||
| collectorMap[c.Id] = modelarts | |||||
| executorMap[c.Id] = modelarts | |||||
| case SHUGUANGAI: | |||||
| id, _ := strconv.ParseInt(c.Id, 10, 64) | |||||
| aCRpc := hpcacclient.NewHpcAC(zrpc.MustNewClient(conf.ACRpcConf)) | |||||
| sgai := storeLink.NewShuguangAi(aCRpc, c.Nickname, id) | |||||
| collectorMap[c.Id] = sgai | |||||
| executorMap[c.Id] = sgai | |||||
| } | |||||
| } | |||||
| return executorMap, collectorMap | |||||
| } | |||||
| func UpdateClusterResource(svc *svc.ServiceContext) { | |||||
| list, err := svc.Scheduler.AiStorages.GetAdaptersByType("1") | |||||
| if err != nil { | |||||
| return | |||||
| } | |||||
| var wg sync.WaitGroup | |||||
| for _, adapter := range list { | |||||
| clusters, err := svc.Scheduler.AiStorages.GetClustersByAdapterId(adapter.Id) | |||||
| if err != nil { | |||||
| continue | |||||
| } | |||||
| for _, cluster := range clusters.List { | |||||
| c := cluster | |||||
| clusterResource, err := svc.Scheduler.AiStorages.GetClusterResourcesById(c.Id) | |||||
| if err != nil { | |||||
| continue | |||||
| } | |||||
| wg.Add(1) | |||||
| go func() { | |||||
| _, ok := svc.Scheduler.AiService.AiCollectorAdapterMap[adapter.Id][c.Id] | |||||
| if !ok { | |||||
| wg.Done() | |||||
| return | |||||
| } | |||||
| h := http.Request{} | |||||
| stat, err := svc.Scheduler.AiService.AiCollectorAdapterMap[adapter.Id][c.Id].GetResourceStats(h.Context()) | |||||
| if err != nil { | |||||
| wg.Done() | |||||
| return | |||||
| } | |||||
| if stat == nil { | |||||
| wg.Done() | |||||
| return | |||||
| } | |||||
| clusterType, err := strconv.ParseInt(adapter.Type, 10, 64) | |||||
| if err != nil { | |||||
| wg.Done() | |||||
| return | |||||
| } | |||||
| var cardTotal int64 | |||||
| var topsTotal float64 | |||||
| for _, card := range stat.CardsAvail { | |||||
| cardTotal += int64(card.CardNum) | |||||
| topsTotal += card.TOpsAtFp16 * float64(card.CardNum) | |||||
| } | |||||
| if (models.TClusterResource{} == *clusterResource) { | |||||
| err = svc.Scheduler.AiStorages.SaveClusterResources(adapter.Id, c.Id, c.Name, clusterType, float64(stat.CpuCoreAvail), float64(stat.CpuCoreTotal), | |||||
| stat.MemAvail, stat.MemTotal, stat.DiskAvail, stat.DiskTotal, float64(stat.GpuAvail), float64(stat.GpuTotal), cardTotal, topsTotal) | |||||
| if err != nil { | |||||
| wg.Done() | |||||
| return | |||||
| } | |||||
| } else { | |||||
| if stat.CpuCoreTotal == 0 || stat.MemTotal == 0 || stat.DiskTotal == 0 { | |||||
| wg.Done() | |||||
| return | |||||
| } | |||||
| clusterResource.CardTotal = cardTotal | |||||
| clusterResource.CardTopsTotal = topsTotal | |||||
| clusterResource.CpuAvail = float64(stat.CpuCoreAvail) | |||||
| clusterResource.CpuTotal = float64(stat.CpuCoreTotal) | |||||
| clusterResource.MemAvail = stat.MemAvail | |||||
| clusterResource.MemTotal = stat.MemTotal | |||||
| clusterResource.DiskAvail = stat.DiskAvail | |||||
| clusterResource.DiskTotal = stat.DiskTotal | |||||
| err := svc.Scheduler.AiStorages.UpdateClusterResources(clusterResource) | |||||
| if err != nil { | |||||
| wg.Done() | |||||
| return | |||||
| } | |||||
| } | |||||
| wg.Done() | |||||
| }() | |||||
| } | |||||
| } | |||||
| wg.Wait() | |||||
| } | |||||
| @@ -1,42 +0,0 @@ | |||||
| /* | |||||
| 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 cron | |||||
| import ( | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/scheduler/service/status" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | |||||
| ) | |||||
| func AddCronGroup(svc *svc.ServiceContext) { | |||||
| svc.Cron.AddFunc("*/5 * * * * ?", func() { | |||||
| list, err := GetTaskList(svc) | |||||
| if err != nil { | |||||
| logx.Errorf(err.Error()) | |||||
| return | |||||
| } | |||||
| status.UpdateTaskStatus(svc, list) | |||||
| status.UpdateAiTaskStatus(svc, list) | |||||
| }) | |||||
| svc.Cron.AddFunc("*/5 * * * * ?", func() { | |||||
| UpdateAiAdapterMaps(svc) | |||||
| }) | |||||
| svc.Cron.AddFunc("*/59 * * * * ?", func() { | |||||
| UpdateClusterResource(svc) | |||||
| }) | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package adapters | |||||
| import ( | |||||
| "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) | |||||
| return | |||||
| } | |||||
| l := adapters.NewAdaptersListLogic(r.Context(), svcCtx) | |||||
| resp, err := l.AdaptersList(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package adapters | |||||
| import ( | |||||
| "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) | |||||
| return | |||||
| } | |||||
| l := adapters.NewClusterListLogic(r.Context(), svcCtx) | |||||
| resp, err := l.ClusterList(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package adapters | |||||
| import ( | |||||
| "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) | |||||
| return | |||||
| } | |||||
| l := adapters.NewCreateAdapterLogic(r.Context(), svcCtx) | |||||
| resp, err := l.CreateAdapter(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package adapters | |||||
| import ( | |||||
| "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) | |||||
| return | |||||
| } | |||||
| l := adapters.NewCreateClusterLogic(r.Context(), svcCtx) | |||||
| resp, err := l.CreateCluster(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package adapters | |||||
| import ( | |||||
| "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) | |||||
| return | |||||
| } | |||||
| l := adapters.NewDeleteAdapterLogic(r.Context(), svcCtx) | |||||
| resp, err := l.DeleteAdapter(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package adapters | |||||
| import ( | |||||
| "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) | |||||
| return | |||||
| } | |||||
| l := adapters.NewDeleteClusterLogic(r.Context(), svcCtx) | |||||
| resp, err := l.DeleteCluster(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package adapters | |||||
| import ( | |||||
| "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) | |||||
| return | |||||
| } | |||||
| l := adapters.NewGetAdapterLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetAdapter(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package adapters | |||||
| import ( | |||||
| "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) | |||||
| return | |||||
| } | |||||
| l := adapters.NewGetAdapterRelationLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetAdapterRelation(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package adapters | |||||
| import ( | |||||
| "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) | |||||
| return | |||||
| } | |||||
| l := adapters.NewGetClusterLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetCluster(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package adapters | |||||
| import ( | |||||
| "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) | |||||
| return | |||||
| } | |||||
| l := adapters.NewGetClusterSumLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetClusterSum(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package adapters | |||||
| import ( | |||||
| "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) | |||||
| return | |||||
| } | |||||
| l := adapters.NewUpdateAdapterLogic(r.Context(), svcCtx) | |||||
| resp, err := l.UpdateAdapter(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package adapters | |||||
| import ( | |||||
| "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) | |||||
| return | |||||
| } | |||||
| l := adapters.NewUpdateClusterLogic(r.Context(), svcCtx) | |||||
| resp, err := l.UpdateCluster(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewCreateAlgorithmLogic(r.Context(), svcCtx) | |||||
| resp, err := l.CreateAlgorithm(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewCreateDataSetLogic(r.Context(), svcCtx) | |||||
| resp, err := l.CreateDataSet(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewCreateExportTaskLogic(r.Context(), svcCtx) | |||||
| resp, err := l.CreateExportTask(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewCreateNotebookLogic(r.Context(), svcCtx) | |||||
| resp, err := l.CreateNotebook(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewCreateProcessorTaskLogic(r.Context(), svcCtx) | |||||
| resp, err := l.CreateProcessorTask(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewCreateServiceLogic(r.Context(), svcCtx) | |||||
| resp, err := l.CreateService(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewCreateTaskLogic(r.Context(), svcCtx) | |||||
| resp, err := l.CreateTask(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewCreateTrainingJobLogic(r.Context(), svcCtx) | |||||
| resp, err := l.CreateTrainingJob(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewCreateVisualizationJobLogic(r.Context(), svcCtx) | |||||
| resp, err := l.CreateVisualizationJob(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewDeleteAlgorithmLogic(r.Context(), svcCtx) | |||||
| resp, err := l.DeleteAlgorithm(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewDeleteDataSetLogic(r.Context(), svcCtx) | |||||
| resp, err := l.DeleteDataSet(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewDeleteServiceLogic(r.Context(), svcCtx) | |||||
| resp, err := l.DeleteService(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewDeleteTrainingJobLogic(r.Context(), svcCtx) | |||||
| resp, err := l.DeleteTrainingJob(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,21 +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" | |||||
| ) | |||||
| func GetCenterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| l := ai.NewGetCenterListLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetCenterList() | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -1,21 +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" | |||||
| ) | |||||
| func GetCenterOverviewHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| l := ai.NewGetCenterOverviewLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetCenterOverview() | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -1,21 +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" | |||||
| ) | |||||
| func GetCenterQueueingHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| l := ai.NewGetCenterQueueingLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetCenterQueueing() | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -1,21 +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" | |||||
| ) | |||||
| func GetCenterTaskListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| l := ai.NewGetCenterTaskListLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetCenterTaskList() | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewGetExportTasksOfDatasetLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetExportTasksOfDataset(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewGetExportTaskStatusOfDatasetLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetExportTaskStatusOfDataset(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewGetListTrainingJobsLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetListTrainingJobs(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewGetNotebookStorageLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetNotebookStorage(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewGetVisualizationJobLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetVisualizationJob(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewListAlgorithmsLogic(r.Context(), svcCtx) | |||||
| resp, err := l.ListAlgorithms(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewListClustersLogic(r.Context(), svcCtx) | |||||
| resp, err := l.ListClusters(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewListDataSetLogic(r.Context(), svcCtx) | |||||
| resp, err := l.ListDataSet(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewListImportLogic(r.Context(), svcCtx) | |||||
| resp, err := l.ListImport(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewListNotebookLogic(r.Context(), svcCtx) | |||||
| resp, err := l.ListNotebook(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewListServicesLogic(r.Context(), svcCtx) | |||||
| resp, err := l.ListServices(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewMountNotebookStorageLogic(r.Context(), svcCtx) | |||||
| resp, err := l.MountNotebookStorage(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| func ProxyApiHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.ChatReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewProxyApiLogic(r.Context(), svcCtx) | |||||
| resp, err := l.ProxyApi(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewShowAlgorithmByUuidLogic(r.Context(), svcCtx) | |||||
| resp, err := l.ShowAlgorithmByUuid(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewShowServiceLogic(r.Context(), svcCtx) | |||||
| resp, err := l.ShowService(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewStartNotebookLogic(r.Context(), svcCtx) | |||||
| resp, err := l.StartNotebook(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package ai | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := ai.NewStopNotebookLogic(r.Context(), svcCtx) | |||||
| resp, err := l.StopNotebook(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,16 +0,0 @@ | |||||
| package cloud | |||||
| import ( | |||||
| "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/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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() | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,25 +0,0 @@ | |||||
| package cloud | |||||
| 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/cloud" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" | |||||
| ) | |||||
| func ClusterInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.ClusterInfoReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := cloud.NewClusterInfoLogic(r.Context(), svcCtx) | |||||
| resp, err := l.ClusterInfo(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package cloud | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| func CommitGeneralTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.GeneralTaskReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := cloud.NewCommitGeneralTaskLogic(r.Context(), svcCtx) | |||||
| err := l.CommitGeneralTask(&req) | |||||
| result.HttpResult(r, w, nil, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package cloud | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := cloud.NewControllerMetricsLogic(r.Context(), svcCtx) | |||||
| resp, err := l.ControllerMetrics(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package cloud | |||||
| import ( | |||||
| "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" | |||||
| "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.DeleteClusterReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := cloud.NewDeleteClusterLogic(r.Context(), svcCtx) | |||||
| resp, err := l.DeleteCluster(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package cloud | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := cloud.NewDeleteYamlLogic(r.Context(), svcCtx) | |||||
| resp, err := l.DeleteYaml(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package cloud | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := cloud.NewGetClusterListLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetClusterList(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package cloud | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| func PodLogsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.PodLogsReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := cloud.NewPodLogsLogic(r.Context(), svcCtx, w) | |||||
| resp, err := l.PodLogs(&req, w) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package cloud | |||||
| import ( | |||||
| "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" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := cloud.NewRegisterClusterLogic(r.Context(), svcCtx) | |||||
| resp, err := l.RegisterCluster(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,16 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := core.NewCommitTaskLogic(r.Context(), svcCtx) | |||||
| err := l.CommitTask(&req) | |||||
| result.HttpResult(r, w, nil, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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) | |||||
| return | |||||
| } | |||||
| l := core.NewCommitVmTaskLogic(r.Context(), svcCtx) | |||||
| resp, err := l.CommitVmTask(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,16 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| func CountTaskStatusHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| l := core.NewCountTaskStatusLogic(r.Context(), svcCtx) | |||||
| resp, err := l.CountTaskStatus() | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := core.NewDeleteTaskLogic(r.Context(), svcCtx) | |||||
| err := l.DeleteTask(&req) | |||||
| result.HttpResult(r, w, nil, err) | |||||
| } | |||||
| } | |||||
| @@ -1,16 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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() | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,16 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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() | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,17 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | |||||
| ) | |||||
| func GetDomainResourceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| l := core.NewGetDomainResourceLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetDomainResource() | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,16 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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() | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -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 GetPublicFlavorHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.PublicFlavorReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := core.NewGetPublicFlavorLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetPublicFlavor(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -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 GetPublicImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.PublicImageReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := core.NewGetPublicImageLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetPublicImage(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -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 GetPublicNetworkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.PublicNetworkReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := core.NewGetPublicNetworkLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetPublicNetwork(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -1,16 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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() | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,16 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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) | |||||
| } | |||||
| } | |||||
| @@ -1,17 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | |||||
| ) | |||||
| func GetScreenChartHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| l := core.NewGetScreenChartLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetScreenChart() | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,17 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" | |||||
| "net/http" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | |||||
| ) | |||||
| func GetScreenInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| l := core.NewGetScreenInfoLogic(r.Context(), svcCtx) | |||||
| resp, err := l.GetScreenInfo() | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -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 HomeOverviewHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.HomeOverviewReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := core.NewHomeOverviewLogic(r.Context(), svcCtx) | |||||
| resp, err := l.HomeOverview(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -1,16 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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) | |||||
| } | |||||
| } | |||||
| @@ -1,16 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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() | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := core.NewListClusterLogic(r.Context(), svcCtx) | |||||
| resp, err := l.ListCluster(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,28 +0,0 @@ | |||||
| 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 ListNoticeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req clientCore.ListNoticeReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := core.NewListNoticeLogic(r.Context(), svcCtx) | |||||
| resp, err := l.ListNotice(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -1,16 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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() | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,11 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "github.com/prometheus/client_golang/prometheus/promhttp" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" | |||||
| "net/http" | |||||
| ) | |||||
| func MetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return promhttp.Handler().ServeHTTP | |||||
| } | |||||
| @@ -1,16 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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 PageListTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req types.PageTaskReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := core.NewPageListTaskLogic(r.Context(), svcCtx) | |||||
| resp, err := l.PageListTask(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,16 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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/pkg/repository/result" | |||||
| "net/http" | |||||
| ) | |||||
| 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) | |||||
| } | |||||
| } | |||||
| @@ -1,28 +0,0 @@ | |||||
| 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) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -1,28 +0,0 @@ | |||||
| 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 PushNoticeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req clientCore.PushNoticeReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := core.NewPushNoticeLogic(r.Context(), svcCtx) | |||||
| resp, err := l.PushNotice(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -1,28 +0,0 @@ | |||||
| 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 PushResourceInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | |||||
| return func(w http.ResponseWriter, r *http.Request) { | |||||
| var req clientCore.PushResourceInfoReq | |||||
| if err := httpx.Parse(r, &req); err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| return | |||||
| } | |||||
| l := core.NewPushResourceInfoLogic(r.Context(), svcCtx) | |||||
| resp, err := l.PushResourceInfo(&req) | |||||
| if err != nil { | |||||
| httpx.ErrorCtx(r.Context(), w, err) | |||||
| } else { | |||||
| httpx.OkJsonCtx(r.Context(), w, resp) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -1,28 +0,0 @@ | |||||
| 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) | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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 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) | |||||
| return | |||||
| } | |||||
| l := core.NewPutResourcePanelConfigLogic(r.Context(), svcCtx) | |||||
| err := l.PutResourcePanelConfig(&req) | |||||
| result.HttpResult(r, w, nil, err) | |||||
| } | |||||
| } | |||||
| @@ -1,36 +0,0 @@ | |||||
| 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" | |||||
| "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 { | |||||
| 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) | |||||
| return | |||||
| } | |||||
| l := core.NewScheduleTaskByYamlLogic(r.Context(), svcCtx) | |||||
| resp, err := l.ScheduleTaskByYaml(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := core.NewSyncClusterLoadLogic(r.Context(), svcCtx) | |||||
| err := l.SyncClusterLoad(&req) | |||||
| result.HttpResult(r, w, nil, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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 TaskDetailsHandler(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) | |||||
| return | |||||
| } | |||||
| l := core.NewTaskDetailsLogic(r.Context(), svcCtx) | |||||
| resp, err := l.TaskDetails(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package core | |||||
| import ( | |||||
| "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 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 { | |||||
| result.ParamErrorResult(r, w, err) | |||||
| return | |||||
| } | |||||
| l := core.NewTaskListLogic(r.Context(), svcCtx) | |||||
| resp, err := l.TaskList(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package dictionary | |||||
| import ( | |||||
| "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) | |||||
| return | |||||
| } | |||||
| l := dictionary.NewAddDictLogic(r.Context(), svcCtx) | |||||
| resp, err := l.AddDict(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package dictionary | |||||
| import ( | |||||
| "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) | |||||
| return | |||||
| } | |||||
| l := dictionary.NewAddDictItemLogic(r.Context(), svcCtx) | |||||
| resp, err := l.AddDictItem(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package dictionary | |||||
| import ( | |||||
| "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) | |||||
| return | |||||
| } | |||||
| l := dictionary.NewDeleteDictLogic(r.Context(), svcCtx) | |||||
| resp, err := l.DeleteDict(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||
| @@ -1,24 +0,0 @@ | |||||
| package dictionary | |||||
| import ( | |||||
| "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) | |||||
| return | |||||
| } | |||||
| l := dictionary.NewDeleteDictItemLogic(r.Context(), svcCtx) | |||||
| resp, err := l.DeleteDictItem(&req) | |||||
| result.HttpResult(r, w, resp, err) | |||||
| } | |||||
| } | |||||