From cac72a9fe34c3f1856426fb518a6295c4351fb68 Mon Sep 17 00:00:00 2001 From: jagger Date: Thu, 21 Mar 2024 09:17:41 +0800 Subject: [PATCH 01/15] :bug: fix bugs Signed-off-by: jagger Former-commit-id: 9a5898242bef4338203ee9b798eb8488844bd3b3 --- api/desc/core/pcm-core.api | 8 ++++++++ api/desc/pcm.api | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/api/desc/core/pcm-core.api b/api/desc/core/pcm-core.api index e5334e24..3a186966 100644 --- a/api/desc/core/pcm-core.api +++ b/api/desc/core/pcm-core.api @@ -526,6 +526,14 @@ type ( Server string `form:"server,optional"` PageInfo } + AdapterRelationQueryReq { + Id string `form:"id,optional" db:"id"` + Name string `form:"name,optional"` + Type string `form:"type,optional"` + Nickname string `form:"nickname,optional"` + Version string `form:"version,optional"` + Server string `form:"server,optional"` + } AdapterReq { Id string `json:"id,optional" db:"id"` Name string `json:"name,optional"` diff --git a/api/desc/pcm.api b/api/desc/pcm.api index 72d06db0..3a5a8c40 100644 --- a/api/desc/pcm.api +++ b/api/desc/pcm.api @@ -844,7 +844,7 @@ service pcm { get /adapter/cluster/get (FId) returns (ClusterResp) @handler GetAdapterRelationHandler - get /adapter/relation (AdapterQueryReq) returns (PageResult) + get /adapter/relation (AdapterRelationQueryReq) returns (PageResult) @handler GetClusterSumHandler get /adapter/clusterSum (clusterSumReq) returns (clusterSumReqResp) From 5d90bbad1f1e418a5c3942f4072db5e5961a154f Mon Sep 17 00:00:00 2001 From: jagger Date: Thu, 21 Mar 2024 15:16:38 +0800 Subject: [PATCH 02/15] :bug: fix bugs Signed-off-by: jagger Former-commit-id: 29128e0ca2063bc6aeb6b12a91cf5c535e3fa113 --- .../handler/adapters/getadapterrelationhandler.go | 2 +- api/internal/logic/adapters/getadapterrelationlogic.go | 2 +- api/internal/types/types.go | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/api/internal/handler/adapters/getadapterrelationhandler.go b/api/internal/handler/adapters/getadapterrelationhandler.go index 5695767b..1f265676 100644 --- a/api/internal/handler/adapters/getadapterrelationhandler.go +++ b/api/internal/handler/adapters/getadapterrelationhandler.go @@ -11,7 +11,7 @@ import ( func GetAdapterRelationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - var req types.AdapterQueryReq + var req types.AdapterRelationQueryReq if err := httpx.Parse(r, &req); err != nil { result.ParamErrorResult(r, w, err) return diff --git a/api/internal/logic/adapters/getadapterrelationlogic.go b/api/internal/logic/adapters/getadapterrelationlogic.go index c2e21e44..afc6952b 100644 --- a/api/internal/logic/adapters/getadapterrelationlogic.go +++ b/api/internal/logic/adapters/getadapterrelationlogic.go @@ -24,7 +24,7 @@ func NewGetAdapterRelationLogic(ctx context.Context, svcCtx *svc.ServiceContext) } } -func (l *GetAdapterRelationLogic) GetAdapterRelation(req *types.AdapterQueryReq) (resp *types.PageResult, err error) { +func (l *GetAdapterRelationLogic) GetAdapterRelation(req *types.AdapterRelationQueryReq) (resp *types.PageResult, err error) { resp = &types.PageResult{} var list []types.AdapterInfo db := l.svcCtx.DbEngin.Model(&types.AdapterInfo{}).Table("t_adapter") diff --git a/api/internal/types/types.go b/api/internal/types/types.go index b502caac..049345c2 100644 --- a/api/internal/types/types.go +++ b/api/internal/types/types.go @@ -525,6 +525,15 @@ type AdapterQueryReq struct { PageInfo } +type AdapterRelationQueryReq struct { + Id string `form:"id,optional" db:"id"` + Name string `form:"name,optional"` + Type string `form:"type,optional"` + Nickname string `form:"nickname,optional"` + Version string `form:"version,optional"` + Server string `form:"server,optional"` +} + type AdapterReq struct { Id string `json:"id,optional" db:"id"` Name string `json:"name,optional"` From 1cb0a39320daae86d2e8fbb73b13ca96f50533c0 Mon Sep 17 00:00:00 2001 From: tzwang Date: Thu, 21 Mar 2024 18:02:45 +0800 Subject: [PATCH 03/15] modified shuguangai getResourceStats Former-commit-id: a108e00353ec13e300772ebbaa2a40a46e376377 --- .../scheduler/schedulers/aiScheduler.go | 27 +++++++------ .../scheduler/service/collector/collector.go | 5 ++- .../scheduler/strategy/dynamicResources.go | 8 ++-- api/internal/storeLink/shuguangai.go | 38 +++++++++++++------ 4 files changed, 51 insertions(+), 27 deletions(-) diff --git a/api/internal/scheduler/schedulers/aiScheduler.go b/api/internal/scheduler/schedulers/aiScheduler.go index 2d5518fa..8a3a29cd 100644 --- a/api/internal/scheduler/schedulers/aiScheduler.go +++ b/api/internal/scheduler/schedulers/aiScheduler.go @@ -61,12 +61,17 @@ func (as *AiScheduler) PickOptimalStrategy() (strategy.Strategy, error) { if len(resources) == 0 { return nil, errors.New("no cluster has resources") } - params := ¶m.Params{Resources: resources} if len(resources) == 1 { - return &strategy.SingleAssignment{Cluster: &strategy.AssignedCluster{ParticipantId: 0, Name: "", Replicas: 1}}, nil + var cluster strategy.AssignedCluster + cluster.ParticipantId = resources[0].ParticipantId + cluster.Name = resources[0].Name + cluster.Replicas = 1 + return &strategy.SingleAssignment{Cluster: &cluster}, nil } + params := ¶m.Params{Resources: resources} + switch as.option.StrategyName { case strategy.REPLICATION: strategy := strategy.NewReplicationStrategy(¶m.ReplicationParams{Params: params, Replicas: 1}) @@ -75,7 +80,7 @@ func (as *AiScheduler) PickOptimalStrategy() (strategy.Strategy, error) { strategy := strategy.NewPricingStrategy(¶m.ResourcePricingParams{Params: params, Replicas: 1}) return strategy, nil case strategy.DYNAMIC_RESOURCES: - strategy := strategy.NewDynamicResourcesStrategy(resources, as.option, 1) + strategy := strategy.NewDynamicResourcesStrategy(params.Resources, as.option, 1) return strategy, nil } @@ -87,14 +92,14 @@ func (as *AiScheduler) AssignTask(clusters []*strategy.AssignedCluster) error { return errors.New("clusters is nil") } - executorMap := *as.AiExecutor - for _, cluster := range clusters { - _, err := executorMap[cluster.Name].Execute(as.option) - if err != nil { - // TODO: database operation - } - // TODO: database operation - } + //executorMap := *as.AiExecutor + //for _, cluster := range clusters { + // _, err := executorMap[cluster.Name].Execute(as.option) + // if err != nil { + // // TODO: database operation + // } + // // TODO: database operation + //} return nil } diff --git a/api/internal/scheduler/service/collector/collector.go b/api/internal/scheduler/service/collector/collector.go index c6e68851..b4d66c68 100644 --- a/api/internal/scheduler/service/collector/collector.go +++ b/api/internal/scheduler/service/collector/collector.go @@ -9,8 +9,11 @@ type ResourceStats struct { ParticipantId int64 Name string CpuCoreAvail int64 + CpuCoreTotal int64 MemAvail float64 + MemTotal float64 DiskAvail float64 + DiskTotal float64 GpuAvail int64 CardsAvail []*Card CpuCoreHours float64 @@ -23,7 +26,7 @@ type Card struct { Name string TOpsAtFp16 float64 CardHours float64 - Num int32 + CardNum int32 } type DatasetsSpecs struct { diff --git a/api/internal/scheduler/strategy/dynamicResources.go b/api/internal/scheduler/strategy/dynamicResources.go index ea528311..c8d4052f 100644 --- a/api/internal/scheduler/strategy/dynamicResources.go +++ b/api/internal/scheduler/strategy/dynamicResources.go @@ -28,10 +28,10 @@ func (ps *DynamicResourcesStrategy) Schedule() ([]*AssignedCluster, error) { var maxCardHoursAvailable float64 var maxCpuCoreHoursAvailable float64 - var assignedCluster *AssignedCluster + var assignedCluster AssignedCluster var results []*AssignedCluster for _, res := range ps.resources { - if opt.ResourceType == "" { + if opt.ResourceType == "cpu" { if res.CpuCoreHours <= 0 { cluster := &AssignedCluster{ParticipantId: res.ParticipantId, Name: res.Name, Replicas: ps.replicas} results = append(results, cluster) @@ -46,7 +46,7 @@ func (ps *DynamicResourcesStrategy) Schedule() ([]*AssignedCluster, error) { } } - if opt.ResourceType == "" { + if opt.ResourceType == "computeCard" { var maxCurrentCardHours float64 for _, card := range res.CardsAvail { cardHours := common.RoundFloat(card.TOpsAtFp16*card.CardHours, 3) @@ -62,7 +62,7 @@ func (ps *DynamicResourcesStrategy) Schedule() ([]*AssignedCluster, error) { } } } - results = append(results, assignedCluster) + results = append(results, &assignedCluster) return results, nil } diff --git a/api/internal/storeLink/shuguangai.go b/api/internal/storeLink/shuguangai.go index 63a43cf9..f44466fe 100644 --- a/api/internal/storeLink/shuguangai.go +++ b/api/internal/storeLink/shuguangai.go @@ -45,6 +45,7 @@ const ( TRAIN_FILE = "train.py" CPUCOREPRICEPERHOUR = 0.09 DCUPRICEPERHOUR = 2.0 + KB = 1024 ) var RESOURCESGAIMAP = map[string]ResourceSpecSGAI{ @@ -272,17 +273,25 @@ func (s *ShuguangAi) GetResourceStats() (*collector.ResourceStats, error) { return nil, err } - //limitReq := &hpcAC.QueueReq{} - //limitResp, err := s.svcCtx.ACRpc.QueryUserQuotasLimit(s.ctx, limitReq) - //if err != nil { - // return nil, err - //} + limitReq := &hpcAC.QueueReq{} + limitResp, err := s.svcCtx.ACRpc.QueryUserQuotasLimit(s.ctx, limitReq) + if err != nil { + return nil, err + } + totalCpu := limitResp.Data.AccountMaxCpu + totalDcu := limitResp.Data.AccountMaxDcu - //diskReq := &hpcAC.ParaStorQuotaReq{} - //diskResp, err := s.svcCtx.ACRpc.ParaStorQuota(s.ctx, diskReq) - //if err != nil { - // return nil, err - //} + diskReq := &hpcAC.ParaStorQuotaReq{} + diskResp, err := s.svcCtx.ACRpc.ParaStorQuota(s.ctx, diskReq) + if err != nil { + return nil, err + } + + totalDisk := common.RoundFloat(diskResp.Data[0].Threshold*KB*KB, 3) + availDisk := common.RoundFloat((diskResp.Data[0].Threshold-diskResp.Data[0].Usage)*KB*KB, 3) + + generalInfo, err := s.svcCtx.ACRpc.GetGeneralInfo(s.ctx, nil) + memSize := common.RoundFloat(float64(generalInfo.MemoryInGib)*KB*KB, 3) var cards []*collector.Card balance, _ := strconv.ParseFloat(userinfo.Data.AccountBalance, 64) @@ -295,14 +304,21 @@ func (s *ShuguangAi) GetResourceStats() (*collector.ResourceStats, error) { Name: DCU, TOpsAtFp16: DCU_TOPS, CardHours: cardHours, + CardNum: int32(totalDcu), } cards = append(cards, dcu) resourceStats := &collector.ResourceStats{ ParticipantId: s.participantId, Name: s.platform, Balance: balance, - CardsAvail: cards, + CpuCoreTotal: totalCpu, + CpuCoreAvail: 0, + DiskTotal: totalDisk, + DiskAvail: availDisk, + MemTotal: memSize, + MemAvail: 0, CpuCoreHours: cpuHours, + CardsAvail: cards, } return resourceStats, nil From c6ad5637be30c5aba5768bdee85bb7e42a26b02c Mon Sep 17 00:00:00 2001 From: qiwang <1364512070@qq.com> Date: Fri, 22 Mar 2024 15:53:31 +0800 Subject: [PATCH 04/15] fix:Modify configuration file fields Former-commit-id: b3e7609f704e567a9501719fe9ca56d81f9bc4f4 --- api/desc/core/pcm-core.api | 2 +- api/desc/vm/pcm-vm.api | 152 +++++++++---------- api/etc/pcm.yaml | 3 +- api/internal/handler/routes.go | 10 -- api/internal/logic/core/commitvmtasklogic.go | 6 +- api/internal/logic/vm/getimagenumlogic.go | 9 +- api/internal/logic/vm/getnetworknumlogic.go | 2 - api/internal/types/types.go | 151 +++++++++--------- 8 files changed, 162 insertions(+), 173 deletions(-) diff --git a/api/desc/core/pcm-core.api b/api/desc/core/pcm-core.api index 8104cae7..18ab6f92 100644 --- a/api/desc/core/pcm-core.api +++ b/api/desc/core/pcm-core.api @@ -107,7 +107,7 @@ type ( NsID string `json:"nsID"` Replicas int64 `json:"replicas,optional"` MatchLabels map[string]string `json:"matchLabels,optional"` - server []ServerCommit `json:"server,optional"` + servers []ServerCommit `json:"servers,optional"` platform string `json:"platform,optional"` } ServerCommit { diff --git a/api/desc/vm/pcm-vm.api b/api/desc/vm/pcm-vm.api index e51ebf21..5640456b 100644 --- a/api/desc/vm/pcm-vm.api +++ b/api/desc/vm/pcm-vm.api @@ -36,7 +36,7 @@ type ( absolute Absolute `json:"absolute,optional"` } GetComputeLimitsReq { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } GetComputeLimitsResp { @@ -66,7 +66,7 @@ type ( absolute VolumeAbsolute `json:"absolute,optional"` } GetVolumeLimitsReq { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } GetVolumeLimitsResp { @@ -81,7 +81,7 @@ type ( ListServersReq { Limit int32 `form:"limit,optional"` OffSet int32 `form:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } ListServersResp { TotalNumber uint32 `json:"totalNumber" copier:"TotalNumber"` @@ -111,7 +111,7 @@ type ( type ( ListServersDetailedReq { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } ListServersDetailedResp { ServersDetailed []ServersDetailed `json:"servers" copier:"ServersDetailed"` @@ -137,7 +137,7 @@ type ( type( GetServersDetailedByIdReq{ ServerId string `form:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } GetServersDetailedByIdResp{ @@ -222,7 +222,7 @@ type( UpdateServerReq{ ServerId string `form:"server_id" copier:"ServerId"` ServerUpdate ServerUpdate `json:"server_update" copier:"ServerUpdate"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } ServerUpdate{ Server Server `json:"server" copier:"Server"` @@ -239,7 +239,7 @@ type ( ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"action,optional" copier:"Action"` start_action string `json:"start_action" copier:"start_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } StartServerResp { Msg string `json:"msg,omitempty"` @@ -253,19 +253,20 @@ type( ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"action,optional" copier:"Action"` stop_action string `json:"stop_action" copier:"stop_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } StopServerResp { Msg string `json:"msg,omitempty"` ErrorMsg string `json:"errorMsg,omitempty"` - Code int32 `json:"code,omitempty"` } + Code int32 `json:"code,omitempty"` + } ) type( RebootServerReq{ ServerId string `json:"server_id" copier:"ServerId"` Reboot Reboot `json:"reboot" copier:"Reboot"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } RebootServerResp { Msg string `json:"msg,omitempty"` @@ -281,7 +282,7 @@ type( ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` pause_action string `json:"pause_action" copier:"pause_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } PauseServerResp { Msg string `json:"msg,omitempty"` @@ -295,7 +296,7 @@ type( ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` unpause_action string `json:"unpause_action" copier:"unpause_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } UnpauseServerResp { Msg string `json:"msg,omitempty"` @@ -307,7 +308,7 @@ type( type ( DeleteServerReq { ServerId string `form:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } DeleteServerResp { @@ -320,7 +321,7 @@ type ( type ( CreateServerReq { Server Server `json:"server" copier:"Server"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } CreateServerResp { Server ServerResp `json:"server" copier:"Server"` @@ -361,7 +362,7 @@ type ( type( RebuildServerReq{ ServerId string `json:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` Rebuild Rebuild `json:"rebuild" copier:"Rebuild"` } RebuildServerResp { @@ -435,7 +436,7 @@ type( ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` shelve_action string `json:"shelve_action" copier:"shelve_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } ShelveServerResp { Msg string `json:"msg,omitempty"` @@ -447,7 +448,7 @@ type( type( RescueServerReq{ ServerId string `json:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` Rescue Rescue `json:"rescue" copier:"Rescue"` } RescueServerResp { @@ -465,7 +466,7 @@ type( UnRescueServerReq{ ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` UnRescue_action string `json:"UnRescue_action" copier:"UnRescue_action"` Rescue Rescue `json:"rescue" copier:"Rescue"` } @@ -480,7 +481,7 @@ type( ChangeAdministrativePasswordReq{ ServerId string `json:"server_id" copier:"ServerId"` Changepassword string `json:"changePassword" copier:"Changepassword"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` ChangePassword ChangePassword `json:"changepassword" copier:"ChangePassword"` } ChangeAdministrativePasswordResp { @@ -497,7 +498,7 @@ type( SuspendServerReq{ ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` UnRescue_action string `json:"UnRescue_action" copier:"UnRescue_action"` Rescue Rescue `json:"rescue" copier:"Rescue"` } @@ -512,7 +513,7 @@ type( AddSecurityGroupToServerReq{ ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` UnRescue_action string `json:"UnRescue_action" copier:"UnRescue_action"` AddSecurityGroup AddSecurityGroup `json:"addSecurityGroup" copier:"AddSecurityGroup"` } @@ -529,7 +530,7 @@ type( type( removeSecurityGroupReq{ ServerId string `json:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` RemoveSecurityGroup RemoveSecurityGroup `json:"removeSecurityGroup" copier:"RemoveSecurityGroup"` } removeSecurityGroupResp { @@ -565,7 +566,7 @@ type( type( DeleteFlavorReq{ - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` ServerId string `json:"server_id" copier:"ServerId"` FlavorId string `json:"flavor_id" copier:"FlavorId"` } @@ -581,8 +582,7 @@ type( /******************find images end*************************/ type ( ListImagesReq { - Limit int32 `form:"limit,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } ListImagesResp { First string `json:"first" copier:"First"` @@ -651,7 +651,7 @@ type ( type ( UploadOsImageReq { ImageId string `form:"image_id" copier:"ImageId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } UploadOsImageResp { Code int32 `json:"code,omitempty" copier:"Code"` @@ -663,7 +663,7 @@ type ( type ( DeleteImageReq { ImageId string `form:"image_id" copier:"ImageId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } DeleteImageResp { Code int32 `json:"code,omitempty"` @@ -695,7 +695,7 @@ type ( type ( ListNetworksReq { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } ListNetworksResp { Networks []Network `json:"networks" copier:"Networks"` @@ -734,7 +734,7 @@ type ( type ( DeleteNetworkReq { NetworkId string `form:"network_id" copier:"NetworkId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } DeleteNetworkResp { Code int32 `json:"code,omitempty" copier:"Code"` @@ -745,7 +745,7 @@ type ( type ( CreateNetworkReq { Network CreateNetwork `json:"network" copier:"Network"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } CreateNetworkResp { Network Network `json:"network" copier:"Network"` @@ -763,7 +763,7 @@ type ( type ( CreateSubnetReq { Subnet Subnet `json:"subnet" copier:"Subnet"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } CreateSubnetResp { Subnet SubnetResp `json:"subnet" copier:"Subnet"` @@ -816,7 +816,7 @@ type ( type( ShowNetworkDetailsReq{ NetworkId string `form:"network_id" copier:"NetworkId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } ShowNetworkDetailsResp{ Network Networkdetail `json:"network" copier:"Network"` @@ -855,7 +855,7 @@ type( UpdateNetworkReq { NetworkId string `form:"network_id" copier:"NetworkId"` Network Network `json:"network" copier:"Network"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } UpdateNetworkResp { Network Network `json:"network" copier:"Network"` @@ -882,7 +882,7 @@ type( ListSubnetsReq { Limit int32 `json:"limit,optional"` OffSet int32 `json:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } ListSubnetsResp { Subnets []Subnets `json:"subnets" copier:"Subnets"` @@ -923,7 +923,7 @@ type( type( DeleteSubnetReq{ subnetId string `json:"subnet_id,optional" copier:"subnetId"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } DeleteSubnetResp{ Code int32 `json:"code,omitempty" copier:"Code"` @@ -935,7 +935,7 @@ type( type( UpdateSubnetReq{ subnetId string `json:"subnet_id,optional" copier:"subnetId"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } UpdateSubnetResp{ Code int32 `json:"code,omitempty" copier:"Code"` @@ -980,7 +980,7 @@ type ( ListNetworkSegmentRangesReq{ Limit int32 `json:"limit,optional"` OffSet int32 `json:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } ListNetworkSegmentRangesResp{ @@ -1012,7 +1012,7 @@ type ( type( DeleteNetworkSegmentRangesReq{ network_segment_range_id string `json:"network_segment_range_id,optional" copier:"network_segment_range_id"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } DeleteNetworkSegmentRangesResp{ Code int32 `json:"code,omitempty" copier:"Code"` @@ -1025,7 +1025,7 @@ type( UpdateNetworkSegmentRangesReq{ network_segment_range_id string `json:"network_segment_range_id,optional" copier:"network_segment_range_id"` NetworkSegmentRange Network_segment_range `json:"network_segment_range,optional" copier:"NetworkSegmentRange"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } UpdateNetworkSegmentRangesResp{ NetworkSegmentRange Network_segment_range `json:"network_segment_range,optional" copier:"NetworkSegmentRange"` @@ -1099,7 +1099,7 @@ type ( ListPortsReq{ Limit int32 `json:"limit,optional"` OffSet int32 `json:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } ListPortsResp{ ports []PortLists `json:"ports,optional" copier:"ports"` @@ -1155,7 +1155,7 @@ type ( type( DeletePortReq{ port_id string `json:"port_id,optional" copier:"port_id"` - platform string `json:"platform,optional" copier:"platform"` + platform string `form:"platform,optional" copier:"platform"` } DeletePortResp{ Code int32 `json:"code,omitempty" copier:"Code"` @@ -1168,7 +1168,7 @@ type( UpdatePortReq{ port_id string `json:"port_id,optional" copier:"port_id"` port Port `json:"port,optional" copier:"port"` - platform string `json:"platform,optional" copier:"platform"` + platform string `form:"platform,optional" copier:"platform"` } UpdatePortResp{ port Port `json:"port,optional" copier:"port"` @@ -1182,7 +1182,7 @@ type( ShowPortDetailsReq{ port_id string `json:"port_id,optional" copier:"port_id"` fields string `json:"fields,optional" copier:"fields"` - platform string `json:"platform,optional" copier:"platform"` + platform string `form:"platform,optional" copier:"platform"` } ShowPortDetailsResp{ port Port `json:"port,optional" copier:"port"` @@ -1197,7 +1197,7 @@ type( ListRoutersReq{ Limit int32 `json:"limit,optional"` OffSet int32 `json:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } ListRoutersResp{ routers []Routers `json:"routers,optional" copier:"routers"` @@ -1288,7 +1288,7 @@ type( type( UpdateRouterReq{ router Router `json:"router,optional" copier:"router"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } UpdateRouterResp{ @@ -1302,7 +1302,7 @@ type( type( ShowRouterDetailsReq{ router Router `json:"router,optional" copier:"router"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } ShowRouterDetailsResp{ @@ -1315,7 +1315,7 @@ type( type( DeleteRouterReq{ - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` router_id string `json:"router_id,optional" copier:"router_id"` } DeleteRouterResp{ @@ -1328,7 +1328,7 @@ type( //浮动IPs type( ListFloatingIPsReq{ - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Limit int32 `json:"limit,optional" copier:"Limit"` OffSet int32 `json:"offSet,optional" copier:"OffSet"` } @@ -1413,7 +1413,7 @@ type( type ( UpdateFloatingIPReq{ - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` floatingip_id string `json:"floatingip_id,optional" copier:"floatingip_id"` floatingip Floatingip `json:"floatingip,optional" copier:"floatingip"` } @@ -1427,7 +1427,7 @@ type ( type ( DeleteFloatingIPReq{ - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` floatingip_id string `json:"floatingip_id,optional" copier:"floatingip_id"` } DeleteFloatingIPResp{ @@ -1453,7 +1453,7 @@ type ( //firewall type ( ListFirewallGroupsReq{ - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` fields string `json:"fields,optional" copier:"fields"` } ListFirewallGroupsResp{ @@ -1480,7 +1480,7 @@ type ( type( DeleteFirewallGroupReq { firewall_group_id string `json:"firewall_group_id,optional" copier:"firewall_group_id"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } DeleteFirewallGroupResp { Code int32 `json:"code,omitempty" copier:"Code"` @@ -1518,7 +1518,7 @@ type( type ( UpdateFirewallGroupReq{ firewall_group Firewall_group `json:"firewall_group,optional" copier:"firewall_group"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` firewall_group_id string `json:"firewall_group_id,optional" copier:"firewall_group_id"` } UpdateFirewallGroupResp{ @@ -1531,7 +1531,7 @@ type ( type ( ShowFirewallGroupDetailsReq{ - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` firewall_group_id string `json:"firewall_group_id,optional" copier:"firewall_group_id"` } ShowFirewallGroupDetailsResp{ @@ -1567,7 +1567,7 @@ type( type( DeleteFirewallPolicyReq{ - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` firewall_policy_id string `json:"firewall_policy_id,optional" copier:"firewall_policy_id"` } DeleteFirewallPolicyResp{ @@ -1579,7 +1579,7 @@ type( type( ListFirewallPoliciesReq{ - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` fields string `json:"fields,optional" copier:"fields"` } ListFirewallPoliciesResp{ @@ -1647,7 +1647,7 @@ type( type ( DeleteFirewallRuleReq{ - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` firewall_rule_id string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"` } DeleteFirewallRuleResp{ @@ -1659,7 +1659,7 @@ type ( type ( ListFirewallRulesReq{ - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` fields string `json:"fields,optional" copier:"fields"` } ListFirewallRulesResp{ @@ -1690,7 +1690,7 @@ type ( type ( ShowFirewallRuleDetailsReq{ - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` firewall_rule_id string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"` } ShowFirewallRuleDetailsResp{ @@ -1704,7 +1704,7 @@ type ( //Security Group type ( ListSecurityGroupsReq{ - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` fields string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"` } ListSecurityGroupsResp{ @@ -1730,7 +1730,7 @@ type ( type ( CreateSecurityGroupReq{ - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` firewall_rule_id string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"` } CreateSecurityGroupResp{ @@ -1776,7 +1776,7 @@ type ( type( DeleteSecurityGroupReq{ - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` security_group_id string `json:"security_group_id,optional" copier:"security_group_id"` } DeleteSecurityGroupResp{ @@ -1788,7 +1788,7 @@ type( type( UpdateSecurityGroupReq{ - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` security_group_id string `json:"security_group_id,optional" copier:"security_group_id"` } UpdateSecurityGroupResp{ @@ -1802,7 +1802,7 @@ type( type( ShowSecurityGroupReq{ - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` security_group_id string `json:"security_group_id,optional" copier:"security_group_id"` fields string `json:"fields,optional" copier:"fields"` verbose string `json:"verbose,optional" copier:"verbose"` @@ -1818,7 +1818,7 @@ type( //SecurityGroupRules type( ListSecurityGroupRulesReq{ - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } ListSecurityGroupRulesResp{ Code int32 `json:"code,omitempty" copier:"Code"` @@ -1861,7 +1861,7 @@ type( type( ShowSecurityGroupRuleReq{ - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` security_group_rule_id string `json:"security_group_rule_id,optional" copier:"security_group_rule_id"` } ShowSecurityGroupRuleResp{ @@ -1874,7 +1874,7 @@ type( type( DeleteSecurityGroupRuleReq{ - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` security_group_rule_id string `json:"security_group_rule_id,optional" copier:"security_group_rule_id"` } DeleteSecurityGroupRuleResp{ @@ -1890,7 +1890,7 @@ type( /******************find ListVolumesDetail start*************************/ type ( ListVolumesDetailReq { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } ListVolumesDetailResp { VolumeDetail []VolumeDetail `json:"volumes" copier:"VolumeDetail"` @@ -1925,7 +1925,7 @@ type ( VolumeId string `form:"volume_id" copier:"VolumeId"` Cascade bool `json:"cascade" copier:"Cascade"` Force bool `json:"force" copier:"force"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } DeleteVolumeResp { Code int32 `json:"code,omitempty" copier:"Code"` @@ -1976,7 +1976,7 @@ type ( ) type ( ListVolumeTypesReq { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } ListVolumeTypesResp { VolumeTypes []Volume_types `json:"volume_types" copier:"VolumeTypes"` @@ -2002,7 +2002,7 @@ type( UpdateVolumeReq { Volume Volume `json:"volume" copier:"Volume"` VolumeId string `json:"volume_id" copier:"VolumeId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } UpdateVolumeResp { Volume Volume `json:"volume" copier:"Volume"` @@ -2015,7 +2015,7 @@ type( type( GetVolumeDetailedByIdReq { VolumeId string `form:"volume_id" copier:"VolumeId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } GetVolumeDetailedByIdResp { Volume VolumeDetailed `json:"volume" copier:"Volume"` @@ -2067,7 +2067,7 @@ type( type( DeleteVolumeTypeReq { VolumeTypeId string `json:"volume_type_id" copier:"VolumeTypeId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } DeleteVolumeTypeResp { Code int32 `json:"code,omitempty" copier:"Code"` @@ -2087,7 +2087,7 @@ type( CreatedAt string `json:"created_at" copier:"CreatedAt"` ConsumesQuota bool `json:"consumes_quota" copier:"ConsumesQuota"` UpdatedAt string `json:"updated_at" copier:"UpdatedAt"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } ListVolumesResp { Volumes []VolumesList `json:"volumes" copier:"Volumes"` @@ -2106,7 +2106,7 @@ type( type ( ListFlavorsDetailReq { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } ListFlavorsDetailResp { @@ -2133,7 +2133,7 @@ type ( /******************Bare Metal start*************************/ type( ListNodesReq { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` Limit int64 `json:"limit" copier:"Limit"` Marker string `json:"marker" copier:"Marker"` SortDir string `json:"sort_dir" copier:"SortDir"` diff --git a/api/etc/pcm.yaml b/api/etc/pcm.yaml index 11432c95..9a9702a4 100644 --- a/api/etc/pcm.yaml +++ b/api/etc/pcm.yaml @@ -5,7 +5,8 @@ Port: 8999 Timeout: 50000 DB: - DataSource: root:uJpLd6u-J?HC1@(10.206.0.12:3306)/pcm?parseTime=true&loc=Local + # 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 diff --git a/api/internal/handler/routes.go b/api/internal/handler/routes.go index e8c4b9a9..6822d544 100644 --- a/api/internal/handler/routes.go +++ b/api/internal/handler/routes.go @@ -134,16 +134,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { Path: "/core/metrics", Handler: core.MetricsHandler(serverCtx), }, - { - Method: http.MethodGet, - Path: "/core/pullTaskInfo", - Handler: core.PullTaskInfoHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/pushTaskInfo", - Handler: core.PushTaskInfoHandler(serverCtx), - }, }, rest.WithPrefix("/pcm/v1"), ) diff --git a/api/internal/logic/core/commitvmtasklogic.go b/api/internal/logic/core/commitvmtasklogic.go index 5d803bf2..4b81af55 100644 --- a/api/internal/logic/core/commitvmtasklogic.go +++ b/api/internal/logic/core/commitvmtasklogic.go @@ -8,6 +8,7 @@ import ( "gitlink.org.cn/JointCloud/pcm-coordinator/api/pkg/response" "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants" "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models" + tool "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils" "time" "github.com/zeromicro/go-zero/core/logx" @@ -41,14 +42,15 @@ func (l *CommitVmTaskLogic) CommitVmTask(req *types.CommitVmTaskReq) (resp *type if tx.Error != nil { return nil, tx.Error } - /* hpc := models.Hpc{} - tool.Convert(req, &hpc)*/ + vm := models.Vm{} + tool.Convert(req, &vm) mqInfo := response.TaskInfo{ TaskId: taskModel.Id, TaskType: "vm", MatchLabels: req.MatchLabels, NsID: req.NsID, } + //req.TaskId = taskModel.Id mqs.InsQueue.Beta.Add(&mqInfo) return } diff --git a/api/internal/logic/vm/getimagenumlogic.go b/api/internal/logic/vm/getimagenumlogic.go index eac511af..24f763d2 100644 --- a/api/internal/logic/vm/getimagenumlogic.go +++ b/api/internal/logic/vm/getimagenumlogic.go @@ -3,11 +3,9 @@ package vm import ( "context" "fmt" - "github.com/jinzhu/copier" "github.com/pkg/errors" "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr" "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils" "gitlink.org.cn/JointCloud/pcm-openstack/openstack" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" @@ -33,9 +31,10 @@ func NewGetImageNumLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetIm func (l *GetImageNumLogic) GetImageNum(req *types.ListImagesReq) (resp *types.ImageNum, err error) { // todo: add your logic here and delete this line resp = &types.ImageNum{} - ListImagesReq := &openstack.ListImagesReq{} - err = copier.CopyWithOption(ListImagesReq, req, copier.Option{Converters: utils.Converters}) - ListImagesResp, err := l.svcCtx.OpenstackRpc.ListImages(l.ctx, ListImagesReq) + listImagesReq := &openstack.ListImagesReq{} + listImagesReq.Platform = req.Platform + //err = copier.CopyWithOption(ListImagesReq, req, copier.Option{Converters: utils.Converters}) + ListImagesResp, err := l.svcCtx.OpenstackRpc.ListImages(l.ctx, listImagesReq) if err != nil { return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get Networks list"), "Failed to get db Servers list err : %v ,req:%+v", err, req) } diff --git a/api/internal/logic/vm/getnetworknumlogic.go b/api/internal/logic/vm/getnetworknumlogic.go index 65084eba..0d785b1c 100644 --- a/api/internal/logic/vm/getnetworknumlogic.go +++ b/api/internal/logic/vm/getnetworknumlogic.go @@ -2,7 +2,6 @@ package vm import ( "context" - "fmt" "github.com/jinzhu/copier" "github.com/pkg/errors" "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr" @@ -41,7 +40,6 @@ func (l *GetNetworkNumLogic) GetNetworkNum(req *types.ListNetworksReq) (resp *ty } var count int = len(ListNetworksResp.Networks) resp.NetworkNum = int32(count) - fmt.Println(count) if err != nil { return nil, result.NewDefaultError(err.Error()) } diff --git a/api/internal/types/types.go b/api/internal/types/types.go index da62e19a..09f712c9 100644 --- a/api/internal/types/types.go +++ b/api/internal/types/types.go @@ -93,7 +93,7 @@ type CommitVmTaskReq struct { NsID string `json:"nsID"` Replicas int64 `json:"replicas,optional"` MatchLabels map[string]string `json:"matchLabels,optional"` - Server ServerCommit `json:"server,optional"` + Servers []ServerCommit `json:"servers,optional"` Platform string `json:"platform,optional"` } @@ -2569,7 +2569,7 @@ type Limits struct { } type GetComputeLimitsReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type GetComputeLimitsResp struct { @@ -2601,7 +2601,7 @@ type VolumeLimits struct { } type GetVolumeLimitsReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type GetVolumeLimitsResp struct { @@ -2614,7 +2614,7 @@ type GetVolumeLimitsResp struct { type ListServersReq struct { Limit int32 `form:"limit,optional"` OffSet int32 `form:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListServersResp struct { @@ -2643,7 +2643,7 @@ type Servers_links struct { } type ListServersDetailedReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListServersDetailedResp struct { @@ -2667,7 +2667,7 @@ type ServersDetailed struct { type GetServersDetailedByIdReq struct { ServerId string `form:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type GetServersDetailedByIdResp struct { @@ -2755,7 +2755,7 @@ type ExtraSpecs struct { type UpdateServerReq struct { ServerId string `form:"server_id" copier:"ServerId"` ServerUpdate ServerUpdate `json:"server_update" copier:"ServerUpdate"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ServerUpdate struct { @@ -2773,7 +2773,7 @@ type StartServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"action,optional" copier:"Action"` Start_action string `json:"start_action" copier:"start_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type StartServerResp struct { @@ -2786,7 +2786,7 @@ type StopServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"action,optional" copier:"Action"` Stop_action string `json:"stop_action" copier:"stop_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type StopServerResp struct { @@ -2798,7 +2798,7 @@ type StopServerResp struct { type RebootServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Reboot Reboot `json:"reboot" copier:"Reboot"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type RebootServerResp struct { @@ -2815,7 +2815,7 @@ type PauseServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` Pause_action string `json:"pause_action" copier:"pause_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type PauseServerResp struct { @@ -2828,7 +2828,7 @@ type UnpauseServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` Unpause_action string `json:"unpause_action" copier:"unpause_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type UnpauseServerResp struct { @@ -2839,7 +2839,7 @@ type UnpauseServerResp struct { type DeleteServerReq struct { ServerId string `form:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type DeleteServerResp struct { @@ -2850,7 +2850,7 @@ type DeleteServerResp struct { type CreateServerReq struct { Server Server `json:"server" copier:"Server"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type CreateServerResp struct { @@ -2894,7 +2894,7 @@ type ServerResp struct { type RebuildServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` Rebuild Rebuild `json:"rebuild" copier:"Rebuild"` } @@ -2969,7 +2969,7 @@ type ShelveServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` Shelve_action string `json:"shelve_action" copier:"shelve_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ShelveServerResp struct { @@ -2980,7 +2980,7 @@ type ShelveServerResp struct { type RescueServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` Rescue Rescue `json:"rescue" copier:"Rescue"` } @@ -2998,7 +2998,7 @@ type Rescue struct { type UnRescueServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` UnRescue_action string `json:"UnRescue_action" copier:"UnRescue_action"` Rescue Rescue `json:"rescue" copier:"Rescue"` } @@ -3012,7 +3012,7 @@ type UnRescueServerResp struct { type ChangeAdministrativePasswordReq struct { ServerId string `json:"server_id" copier:"ServerId"` Changepassword string `json:"changePassword" copier:"Changepassword"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` ChangePassword ChangePassword `json:"changepassword" copier:"ChangePassword"` } @@ -3029,7 +3029,7 @@ type ChangePassword struct { type SuspendServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` UnRescue_action string `json:"UnRescue_action" copier:"UnRescue_action"` Rescue Rescue `json:"rescue" copier:"Rescue"` } @@ -3043,7 +3043,7 @@ type SuspendServerResp struct { type AddSecurityGroupToServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` UnRescue_action string `json:"UnRescue_action" copier:"UnRescue_action"` AddSecurityGroup AddSecurityGroup `json:"addSecurityGroup" copier:"AddSecurityGroup"` } @@ -3060,7 +3060,7 @@ type AddSecurityGroup struct { type RemoveSecurityGroupReq struct { ServerId string `json:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` RemoveSecurityGroup RemoveSecurityGroup `json:"removeSecurityGroup" copier:"RemoveSecurityGroup"` } @@ -3096,7 +3096,7 @@ type FlavorServer struct { } type DeleteFlavorReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` ServerId string `json:"server_id" copier:"ServerId"` FlavorId string `json:"flavor_id" copier:"FlavorId"` } @@ -3108,8 +3108,7 @@ type DeleteFlavorResp struct { } type ListImagesReq struct { - Limit int32 `form:"limit,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListImagesResp struct { @@ -3179,7 +3178,7 @@ type CreateImageResp struct { type UploadOsImageReq struct { ImageId string `form:"image_id" copier:"ImageId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type UploadOsImageResp struct { @@ -3190,7 +3189,7 @@ type UploadOsImageResp struct { type DeleteImageReq struct { ImageId string `form:"image_id" copier:"ImageId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type DeleteImageResp struct { @@ -3214,7 +3213,7 @@ type ImageNum struct { } type ListNetworksReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListNetworksResp struct { @@ -3254,7 +3253,7 @@ type Network struct { type DeleteNetworkReq struct { NetworkId string `form:"network_id" copier:"NetworkId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type DeleteNetworkResp struct { @@ -3265,7 +3264,7 @@ type DeleteNetworkResp struct { type CreateNetworkReq struct { Network CreateNetwork `json:"network" copier:"Network"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type CreateNetworkResp struct { @@ -3283,7 +3282,7 @@ type CreateNetwork struct { type CreateSubnetReq struct { Subnet Subnet `json:"subnet" copier:"Subnet"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type CreateSubnetResp struct { @@ -3338,7 +3337,7 @@ type Allocation_pools struct { type ShowNetworkDetailsReq struct { NetworkId string `form:"network_id" copier:"NetworkId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ShowNetworkDetailsResp struct { @@ -3377,7 +3376,7 @@ type Networkdetail struct { type UpdateNetworkReq struct { NetworkId string `form:"network_id" copier:"NetworkId"` Network Network `json:"network" copier:"Network"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type UpdateNetworkResp struct { @@ -3402,7 +3401,7 @@ type BulkCreateNetworksResp struct { type ListSubnetsReq struct { Limit int32 `json:"limit,optional"` OffSet int32 `json:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListSubnetsResp struct { @@ -3444,7 +3443,7 @@ type Allocation_pool struct { type DeleteSubnetReq struct { SubnetId string `json:"subnet_id,optional" copier:"subnetId"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type DeleteSubnetResp struct { @@ -3455,7 +3454,7 @@ type DeleteSubnetResp struct { type UpdateSubnetReq struct { SubnetId string `json:"subnet_id,optional" copier:"subnetId"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type UpdateSubnetResp struct { @@ -3500,7 +3499,7 @@ type Used struct { type ListNetworkSegmentRangesReq struct { Limit int32 `json:"limit,optional"` OffSet int32 `json:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListNetworkSegmentRangesResp struct { @@ -3530,7 +3529,7 @@ type Network_segment_ranges struct { type DeleteNetworkSegmentRangesReq struct { Network_segment_range_id string `json:"network_segment_range_id,optional" copier:"network_segment_range_id"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type DeleteNetworkSegmentRangesResp struct { @@ -3542,7 +3541,7 @@ type DeleteNetworkSegmentRangesResp struct { type UpdateNetworkSegmentRangesReq struct { Network_segment_range_id string `json:"network_segment_range_id,optional" copier:"network_segment_range_id"` NetworkSegmentRange Network_segment_range `json:"network_segment_range,optional" copier:"NetworkSegmentRange"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type UpdateNetworkSegmentRangesResp struct { @@ -3614,7 +3613,7 @@ type CreatePortResp struct { type ListPortsReq struct { Limit int32 `json:"limit,optional"` OffSet int32 `json:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListPortsResp struct { @@ -3673,7 +3672,7 @@ type Fixed_ips struct { type DeletePortReq struct { Port_id string `json:"port_id,optional" copier:"port_id"` - Platform string `json:"platform,optional" copier:"platform"` + Platform string `form:"platform,optional" copier:"platform"` } type DeletePortResp struct { @@ -3685,7 +3684,7 @@ type DeletePortResp struct { type UpdatePortReq struct { Port_id string `json:"port_id,optional" copier:"port_id"` Port Port `json:"port,optional" copier:"port"` - Platform string `json:"platform,optional" copier:"platform"` + Platform string `form:"platform,optional" copier:"platform"` } type UpdatePortResp struct { @@ -3698,7 +3697,7 @@ type UpdatePortResp struct { type ShowPortDetailsReq struct { Port_id string `json:"port_id,optional" copier:"port_id"` Fields string `json:"fields,optional" copier:"fields"` - Platform string `json:"platform,optional" copier:"platform"` + Platform string `form:"platform,optional" copier:"platform"` } type ShowPortDetailsResp struct { @@ -3711,7 +3710,7 @@ type ShowPortDetailsResp struct { type ListRoutersReq struct { Limit int32 `json:"limit,optional"` OffSet int32 `json:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListRoutersResp struct { @@ -3805,7 +3804,7 @@ type Router struct { type UpdateRouterReq struct { Router Router `json:"router,optional" copier:"router"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type UpdateRouterResp struct { @@ -3817,7 +3816,7 @@ type UpdateRouterResp struct { type ShowRouterDetailsReq struct { Router Router `json:"router,optional" copier:"router"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type ShowRouterDetailsResp struct { @@ -3828,7 +3827,7 @@ type ShowRouterDetailsResp struct { } type DeleteRouterReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Router_id string `json:"router_id,optional" copier:"router_id"` } @@ -3839,7 +3838,7 @@ type DeleteRouterResp struct { } type ListFloatingIPsReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Limit int32 `json:"limit,optional" copier:"Limit"` OffSet int32 `json:"offSet,optional" copier:"OffSet"` } @@ -3926,7 +3925,7 @@ type Floatingip struct { } type UpdateFloatingIPReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Floatingip_id string `json:"floatingip_id,optional" copier:"floatingip_id"` Floatingip Floatingip `json:"floatingip,optional" copier:"floatingip"` } @@ -3939,7 +3938,7 @@ type UpdateFloatingIPResp struct { } type DeleteFloatingIPReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Floatingip_id string `json:"floatingip_id,optional" copier:"floatingip_id"` } @@ -3962,7 +3961,7 @@ type ShowFloatingIPDetailsResp struct { } type ListFirewallGroupsReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Fields string `json:"fields,optional" copier:"fields"` } @@ -3989,7 +3988,7 @@ type Firewall_groups struct { type DeleteFirewallGroupReq struct { Firewall_group_id string `json:"firewall_group_id,optional" copier:"firewall_group_id"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type DeleteFirewallGroupResp struct { @@ -4026,7 +4025,7 @@ type Firewall_group struct { type UpdateFirewallGroupReq struct { Firewall_group Firewall_group `json:"firewall_group,optional" copier:"firewall_group"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Firewall_group_id string `json:"firewall_group_id,optional" copier:"firewall_group_id"` } @@ -4038,7 +4037,7 @@ type UpdateFirewallGroupResp struct { } type ShowFirewallGroupDetailsReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Firewall_group_id string `json:"firewall_group_id,optional" copier:"firewall_group_id"` } @@ -4073,7 +4072,7 @@ type Firewall_policy struct { } type DeleteFirewallPolicyReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Firewall_policy_id string `json:"firewall_policy_id,optional" copier:"firewall_policy_id"` } @@ -4084,7 +4083,7 @@ type DeleteFirewallPolicyResp struct { } type ListFirewallPoliciesReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Fields string `json:"fields,optional" copier:"fields"` } @@ -4150,7 +4149,7 @@ type Firewall_rule struct { } type DeleteFirewallRuleReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Firewall_rule_id string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"` } @@ -4161,7 +4160,7 @@ type DeleteFirewallRuleResp struct { } type ListFirewallRulesReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Fields string `json:"fields,optional" copier:"fields"` } @@ -4192,7 +4191,7 @@ type Firewall_rules struct { } type ShowFirewallRuleDetailsReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Firewall_rule_id string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"` } @@ -4204,7 +4203,7 @@ type ShowFirewallRuleDetailsResp struct { } type ListSecurityGroupsReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Fields string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"` } @@ -4230,7 +4229,7 @@ type Security_groups struct { } type CreateSecurityGroupReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Firewall_rule_id string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"` } @@ -4277,7 +4276,7 @@ type Security_group_rules struct { } type DeleteSecurityGroupReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Security_group_id string `json:"security_group_id,optional" copier:"security_group_id"` } @@ -4288,7 +4287,7 @@ type DeleteSecurityGroupResp struct { } type UpdateSecurityGroupReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Security_group_id string `json:"security_group_id,optional" copier:"security_group_id"` } @@ -4300,7 +4299,7 @@ type UpdateSecurityGroupResp struct { } type ShowSecurityGroupReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Security_group_id string `json:"security_group_id,optional" copier:"security_group_id"` Fields string `json:"fields,optional" copier:"fields"` Verbose string `json:"verbose,optional" copier:"verbose"` @@ -4314,7 +4313,7 @@ type ShowSecurityGroupResp struct { } type ListSecurityGroupRulesReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type ListSecurityGroupRulesResp struct { @@ -4356,7 +4355,7 @@ type Security_group_rule struct { } type ShowSecurityGroupRuleReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Security_group_rule_id string `json:"security_group_rule_id,optional" copier:"security_group_rule_id"` } @@ -4368,7 +4367,7 @@ type ShowSecurityGroupRuleResp struct { } type DeleteSecurityGroupRuleReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Security_group_rule_id string `json:"security_group_rule_id,optional" copier:"security_group_rule_id"` } @@ -4380,7 +4379,7 @@ type DeleteSecurityGroupRuleResp struct { } type ListVolumesDetailReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListVolumesDetailResp struct { @@ -4414,7 +4413,7 @@ type DeleteVolumeReq struct { VolumeId string `form:"volume_id" copier:"VolumeId"` Cascade bool `json:"cascade" copier:"Cascade"` Force bool `json:"force" copier:"force"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type DeleteVolumeResp struct { @@ -4464,7 +4463,7 @@ type VolumeResp struct { } type ListVolumeTypesReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListVolumeTypesResp struct { @@ -4491,7 +4490,7 @@ type Extra_specs struct { type UpdateVolumeReq struct { Volume Volume `json:"volume" copier:"Volume"` VolumeId string `json:"volume_id" copier:"VolumeId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type UpdateVolumeResp struct { @@ -4503,7 +4502,7 @@ type UpdateVolumeResp struct { type GetVolumeDetailedByIdReq struct { VolumeId string `form:"volume_id" copier:"VolumeId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type GetVolumeDetailedByIdResp struct { @@ -4555,7 +4554,7 @@ type VolumeType struct { type DeleteVolumeTypeReq struct { VolumeTypeId string `json:"volume_type_id" copier:"VolumeTypeId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type DeleteVolumeTypeResp struct { @@ -4575,7 +4574,7 @@ type ListVolumesReq struct { CreatedAt string `json:"created_at" copier:"CreatedAt"` ConsumesQuota bool `json:"consumes_quota" copier:"ConsumesQuota"` UpdatedAt string `json:"updated_at" copier:"UpdatedAt"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListVolumesResp struct { @@ -4592,7 +4591,7 @@ type VolumesList struct { } type ListFlavorsDetailReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListFlavorsDetailResp struct { @@ -4617,7 +4616,7 @@ type Flavors struct { } type ListNodesReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` Limit int64 `json:"limit" copier:"Limit"` Marker string `json:"marker" copier:"Marker"` SortDir string `json:"sort_dir" copier:"SortDir"` From 882c4c0e838cd0207c863af32edd2f219e8f6eb7 Mon Sep 17 00:00:00 2001 From: qiwang <1364512070@qq.com> Date: Fri, 22 Mar 2024 15:57:18 +0800 Subject: [PATCH 05/15] fix:Modify configuration file fields Former-commit-id: e4ef82f78cf5d3380a7a79f3a6591beec35e8667 --- api/etc/pcm.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/etc/pcm.yaml b/api/etc/pcm.yaml index a28b5ff5..37a90f85 100644 --- a/api/etc/pcm.yaml +++ b/api/etc/pcm.yaml @@ -5,8 +5,7 @@ Port: 8999 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 + DataSource: root:uJpLd6u-J?HC1@(10.206.0.12:3306)/pcm?parseTime=true&loc=Local Redis: Host: 10.206.0.12:6379 From c39c628670276502b8b513be117743782f9d290c Mon Sep 17 00:00:00 2001 From: tzwang Date: Fri, 22 Mar 2024 17:16:19 +0800 Subject: [PATCH 06/15] modified staticWeight strategy and separate it from algorithm Former-commit-id: 77630a215c8ad8fd3711f2e941f74e5c75ff29f2 --- .../weightDistributing/weightDistributing.go | 68 +++++++++++++++++ api/internal/scheduler/entity/entity.go | 6 -- .../scheduler/schedulers/aiScheduler.go | 20 +++-- .../scheduler/strategy/staticWeight.go | 76 ++++++------------- .../scheduler/strategy/test/strategy_test.go | 10 +-- 5 files changed, 109 insertions(+), 71 deletions(-) create mode 100644 api/internal/scheduler/algorithm/weightDistributing/weightDistributing.go diff --git a/api/internal/scheduler/algorithm/weightDistributing/weightDistributing.go b/api/internal/scheduler/algorithm/weightDistributing/weightDistributing.go new file mode 100644 index 00000000..0124fa8b --- /dev/null +++ b/api/internal/scheduler/algorithm/weightDistributing/weightDistributing.go @@ -0,0 +1,68 @@ +package weightDistributing + +import ( + "math" +) + +type Weight struct { + Id int64 + Weight int32 + Name string + Replica int32 +} + +func DistributeReplicas(weights []*Weight, replicas int32) { + var weightSum int32 + weightSum = 0 + for _, w := range weights { + weightSum += w.Weight + } + + weightRatio := make([]float64, len(weights)) + for i, w := range weights { + weightRatio[i] = float64(w.Weight) / float64(weightSum) + } + + var rest = replicas + + for i := 0; i < len(weights); i++ { + + var n = math.Round(float64(replicas) * weightRatio[i]) + rest -= int32(n) + + weights[i].Replica = int32(n) + } + + for { + if rest == 0 { + break + } + + maxIdx := 0 + minIdx := 0 + + if rest > 0 { + for i, ratio := range weightRatio { + if ratio > weightRatio[maxIdx] { + maxIdx = i + } + } + } else { + for i, ratio := range weightRatio { + if ratio < weightRatio[minIdx] { + minIdx = i + } + } + } + + if rest > 0 { + weights[maxIdx].Replica++ + weightRatio[maxIdx]-- + rest-- + } else { + weights[minIdx].Replica-- + weightRatio[minIdx]++ + rest++ + } + } +} diff --git a/api/internal/scheduler/entity/entity.go b/api/internal/scheduler/entity/entity.go index 7f5f6951..33e48dba 100644 --- a/api/internal/scheduler/entity/entity.go +++ b/api/internal/scheduler/entity/entity.go @@ -11,9 +11,3 @@ type Participant struct { Name string Participant_id int64 } - -type WeightP struct { - Participant_id int64 - Weight int32 - Name string -} diff --git a/api/internal/scheduler/schedulers/aiScheduler.go b/api/internal/scheduler/schedulers/aiScheduler.go index 8a3a29cd..3ac52d10 100644 --- a/api/internal/scheduler/schedulers/aiScheduler.go +++ b/api/internal/scheduler/schedulers/aiScheduler.go @@ -82,6 +82,10 @@ func (as *AiScheduler) PickOptimalStrategy() (strategy.Strategy, error) { case strategy.DYNAMIC_RESOURCES: strategy := strategy.NewDynamicResourcesStrategy(params.Resources, as.option, 1) return strategy, nil + case strategy.STATIC_WEIGHT: + //todo resources should match cluster StaticWeightMap + strategy := strategy.NewStaticWeightStrategy(as.option.ClusterToStaticWeight, 1) + return strategy, nil } return nil, errors.New("no strategy has been chosen") @@ -92,14 +96,14 @@ func (as *AiScheduler) AssignTask(clusters []*strategy.AssignedCluster) error { return errors.New("clusters is nil") } - //executorMap := *as.AiExecutor - //for _, cluster := range clusters { - // _, err := executorMap[cluster.Name].Execute(as.option) - // if err != nil { - // // TODO: database operation - // } - // // TODO: database operation - //} + executorMap := *as.AiExecutor + for _, cluster := range clusters { + _, err := executorMap[cluster.Name].Execute(as.option) + if err != nil { + // TODO: database operation + } + // TODO: database operation + } return nil } diff --git a/api/internal/scheduler/strategy/staticWeight.go b/api/internal/scheduler/strategy/staticWeight.go index 76230ca3..2172bec3 100644 --- a/api/internal/scheduler/strategy/staticWeight.go +++ b/api/internal/scheduler/strategy/staticWeight.go @@ -2,73 +2,45 @@ package strategy import ( "errors" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/scheduler/entity" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/scheduler/algorithm/weightDistributing" ) type StaticWeightStrategy struct { - // TODO: add fields - - //每个 - num int32 - weights []entity.WeightP + staticWeightMap map[string]int32 + replicas int32 } -func NewStaticWeightStrategy(weights []entity.WeightP, replicas int32) *StaticWeightStrategy { - return &StaticWeightStrategy{weights: weights, - num: replicas, +func NewStaticWeightStrategy(staticWeightMap map[string]int32, replicas int32) *StaticWeightStrategy { + return &StaticWeightStrategy{staticWeightMap: staticWeightMap, + replicas: replicas, } } -func (ps *StaticWeightStrategy) Schedule() ([]*AssignedCluster, error) { - // TODO: implement the scheduling logic return nil, nil +func (s *StaticWeightStrategy) Schedule() ([]*AssignedCluster, error) { - if ps.num < 1 { - return nil, errors.New("numbers must be greater than 0") + if s.replicas < 1 { + return nil, errors.New("replicas must be greater than 0") } - if ps.weights == nil { + if len(s.staticWeightMap) == 0 || s.staticWeightMap == nil { return nil, errors.New("weight must be set") } - var weightSum int32 - weightSum = 0 - for _, w := range ps.weights { - weightSum += w.Weight - } - - weightRatio := make([]float64, len(ps.weights)) - for i, w := range ps.weights { - weightRatio[i] = float64(w.Weight) / float64(weightSum) - } - - var rest = ps.num - var results []*AssignedCluster - - for i := 0; i < len(ps.weights); i++ { - - var n = int(float64(ps.num) * weightRatio[i]) - rest -= int32(n) - - cluster := &AssignedCluster{ParticipantId: ps.weights[i].Participant_id, Name: ps.weights[i].Name, Replicas: int32(n)} - results = append(results, cluster) - } - - if rest != 0 { - if rest < 0 { // 如果差值小于0,需要增加某些元素的值 - for i := len(ps.weights) - 1; rest < 0 && i >= 0; i-- { - if results[i].Replicas < ps.weights[i].Weight { - results[i].Replicas++ - rest++ - } - } - } else { - for i := len(ps.weights) - 1; rest > 0 && i >= 0; i-- { - if results[i].Replicas < ps.weights[i].Weight { - results[i].Replicas-- - rest-- - } - } + weights := make([]*weightDistributing.Weight, 0) + for k, v := range s.staticWeightMap { + weight := &weightDistributing.Weight{ + Name: k, + Weight: v, } + weights = append(weights, weight) + } + + weightDistributing.DistributeReplicas(weights, s.replicas) + + var results []*AssignedCluster + for _, weight := range weights { + cluster := &AssignedCluster{ParticipantId: weight.Id, Name: weight.Name, Replicas: weight.Replica} + results = append(results, cluster) } return results, nil diff --git a/api/internal/scheduler/strategy/test/strategy_test.go b/api/internal/scheduler/strategy/test/strategy_test.go index d2cb9fb1..eb0f59ad 100644 --- a/api/internal/scheduler/strategy/test/strategy_test.go +++ b/api/internal/scheduler/strategy/test/strategy_test.go @@ -63,15 +63,15 @@ func TestReplication(t *testing.T) { } func TestStaticWeight(t *testing.T) { - parts := []entity.WeightP{ - {Name: "p1", Participant_id: 1, Weight: 3}, - {Name: "p2", Participant_id: 2, Weight: 5}, - {Name: "p3", Participant_id: 3, Weight: 2}, + parts := map[string]int32{ + "test1": 6, + "test2": 5, + "test3": 2, } tests := []struct { name string replica int32 - ps []entity.WeightP + ps map[string]int32 }{ { name: "test1", From ae3f90f593083a3379a015d75896ba36f59b7aeb Mon Sep 17 00:00:00 2001 From: qiwang <1364512070@qq.com> Date: Mon, 25 Mar 2024 15:02:06 +0800 Subject: [PATCH 07/15] fix:Modify the interface for querying the number of clusters Former-commit-id: 1be1acd2b05f875026cd21e8973845a6f3fbe9f7 --- api/desc/core/pcm-core.api | 4 +- .../logic/adapters/getclustersumlogic.go | 23 ++- api/internal/types/types.go | 152 +++++++++--------- 3 files changed, 95 insertions(+), 84 deletions(-) diff --git a/api/desc/core/pcm-core.api b/api/desc/core/pcm-core.api index c3063b85..a61f1a35 100644 --- a/api/desc/core/pcm-core.api +++ b/api/desc/core/pcm-core.api @@ -109,6 +109,7 @@ type ( ) type ( + commitVmTaskReq { Name string `json:"name"` NsID string `json:"nsID"` @@ -698,7 +699,8 @@ type clusterSumReq { } type clusterSumReqResp { - ClusterSum int `json:"ClusterSum,omitempty"` + PodSum int `json:"podSum,omitempty"` + VmSum int `json:"vmSum,omitempty"` AdapterSum int `json:"AdapterSum,omitempty"` TaskSum int `json:"TaskSum,omitempty"` } diff --git a/api/internal/logic/adapters/getclustersumlogic.go b/api/internal/logic/adapters/getclustersumlogic.go index 0659e3e1..4a934fed 100644 --- a/api/internal/logic/adapters/getclustersumlogic.go +++ b/api/internal/logic/adapters/getclustersumlogic.go @@ -28,7 +28,8 @@ func (l *GetClusterSumLogic) GetClusterSum(req *types.ClusterSumReq) (resp *type resp = &types.ClusterSumReqResp{} var AdapterSum int // - var ClusterSum int // + var podSum int // + var vmSum int // var TaskSum int // // sqlStr := "SELECT COUNT(*) FROM `t_adapter` t where t.type = 0" @@ -37,12 +38,19 @@ func (l *GetClusterSumLogic) GetClusterSum(req *types.ClusterSumReq) (resp *type logx.Error(err) return nil, tx.Error } - // - sqlStrCluster := "SELECT COUNT(*) FROM `t_cluster`t where t.label ='openstack' || t.label='kubernetes'\n" - txCluster := l.svcCtx.DbEngin.Raw(sqlStrCluster).Scan(&ClusterSum) - if txCluster.Error != nil { + //vm + sqlStrVm := "SELECT COUNT(*) FROM `t_adapter` t left join t_cluster tc on t.id=tc.adapter_id where t.type='3' and tc.deleted_at is null" + txClusterVm := l.svcCtx.DbEngin.Raw(sqlStrVm).Scan(&vmSum) + if txClusterVm.Error != nil { logx.Error(err) - return nil, txCluster.Error + return nil, txClusterVm.Error + } + //pod + sqlStrPod := "SELECT COUNT(*) FROM `t_adapter` t left join t_cluster tc on t.id=tc.adapter_id where t.type='0' and tc.deleted_at is null" + txClusterPod := l.svcCtx.DbEngin.Raw(sqlStrPod).Scan(&podSum) + if txClusterPod.Error != nil { + logx.Error(err) + return nil, txClusterPod.Error } // sqlStrTask := "SELECT COUNT(*) FROM `task`" @@ -52,7 +60,8 @@ func (l *GetClusterSumLogic) GetClusterSum(req *types.ClusterSumReq) (resp *type return nil, txTask.Error } resp.TaskSum = TaskSum - resp.ClusterSum = ClusterSum + resp.VmSum = vmSum + resp.PodSum = podSum resp.AdapterSum = AdapterSum return resp, nil } diff --git a/api/internal/types/types.go b/api/internal/types/types.go index 17307edd..1b863963 100644 --- a/api/internal/types/types.go +++ b/api/internal/types/types.go @@ -678,7 +678,8 @@ type ClusterSumReq struct { } type ClusterSumReqResp struct { - ClusterSum int `json:"ClusterSum,omitempty"` + PodSum int `json:"podSum,omitempty"` + VmSum int `json:"vmSum,omitempty"` AdapterSum int `json:"AdapterSum,omitempty"` TaskSum int `json:"TaskSum,omitempty"` } @@ -2586,7 +2587,7 @@ type Limits struct { } type GetComputeLimitsReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type GetComputeLimitsResp struct { @@ -2618,7 +2619,7 @@ type VolumeLimits struct { } type GetVolumeLimitsReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type GetVolumeLimitsResp struct { @@ -2631,7 +2632,7 @@ type GetVolumeLimitsResp struct { type ListServersReq struct { Limit int32 `form:"limit,optional"` OffSet int32 `form:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListServersResp struct { @@ -2660,7 +2661,7 @@ type Servers_links struct { } type ListServersDetailedReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListServersDetailedResp struct { @@ -2684,7 +2685,7 @@ type ServersDetailed struct { type GetServersDetailedByIdReq struct { ServerId string `form:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type GetServersDetailedByIdResp struct { @@ -2772,7 +2773,7 @@ type ExtraSpecs struct { type UpdateServerReq struct { ServerId string `form:"server_id" copier:"ServerId"` ServerUpdate ServerUpdate `json:"server_update" copier:"ServerUpdate"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ServerUpdate struct { @@ -2790,7 +2791,7 @@ type StartServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"action,optional" copier:"Action"` Start_action string `json:"start_action" copier:"start_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type StartServerResp struct { @@ -2803,7 +2804,7 @@ type StopServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"action,optional" copier:"Action"` Stop_action string `json:"stop_action" copier:"stop_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type StopServerResp struct { @@ -2815,7 +2816,7 @@ type StopServerResp struct { type RebootServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Reboot Reboot `json:"reboot" copier:"Reboot"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type RebootServerResp struct { @@ -2832,7 +2833,7 @@ type PauseServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` Pause_action string `json:"pause_action" copier:"pause_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type PauseServerResp struct { @@ -2845,7 +2846,7 @@ type UnpauseServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` Unpause_action string `json:"unpause_action" copier:"unpause_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type UnpauseServerResp struct { @@ -2856,7 +2857,7 @@ type UnpauseServerResp struct { type DeleteServerReq struct { ServerId string `form:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type DeleteServerResp struct { @@ -2867,7 +2868,7 @@ type DeleteServerResp struct { type CreateServerReq struct { Server Server `json:"server" copier:"Server"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type CreateServerResp struct { @@ -2911,7 +2912,7 @@ type ServerResp struct { type RebuildServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` Rebuild Rebuild `json:"rebuild" copier:"Rebuild"` } @@ -2986,7 +2987,7 @@ type ShelveServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` Shelve_action string `json:"shelve_action" copier:"shelve_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ShelveServerResp struct { @@ -2997,7 +2998,7 @@ type ShelveServerResp struct { type RescueServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` Rescue Rescue `json:"rescue" copier:"Rescue"` } @@ -3015,7 +3016,7 @@ type Rescue struct { type UnRescueServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` UnRescue_action string `json:"UnRescue_action" copier:"UnRescue_action"` Rescue Rescue `json:"rescue" copier:"Rescue"` } @@ -3029,7 +3030,7 @@ type UnRescueServerResp struct { type ChangeAdministrativePasswordReq struct { ServerId string `json:"server_id" copier:"ServerId"` Changepassword string `json:"changePassword" copier:"Changepassword"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` ChangePassword ChangePassword `json:"changepassword" copier:"ChangePassword"` } @@ -3046,7 +3047,7 @@ type ChangePassword struct { type SuspendServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` UnRescue_action string `json:"UnRescue_action" copier:"UnRescue_action"` Rescue Rescue `json:"rescue" copier:"Rescue"` } @@ -3060,7 +3061,7 @@ type SuspendServerResp struct { type AddSecurityGroupToServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` UnRescue_action string `json:"UnRescue_action" copier:"UnRescue_action"` AddSecurityGroup AddSecurityGroup `json:"addSecurityGroup" copier:"AddSecurityGroup"` } @@ -3077,7 +3078,7 @@ type AddSecurityGroup struct { type RemoveSecurityGroupReq struct { ServerId string `json:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` RemoveSecurityGroup RemoveSecurityGroup `json:"removeSecurityGroup" copier:"RemoveSecurityGroup"` } @@ -3113,7 +3114,7 @@ type FlavorServer struct { } type DeleteFlavorReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` ServerId string `json:"server_id" copier:"ServerId"` FlavorId string `json:"flavor_id" copier:"FlavorId"` } @@ -3125,8 +3126,7 @@ type DeleteFlavorResp struct { } type ListImagesReq struct { - Limit int32 `form:"limit,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListImagesResp struct { @@ -3196,7 +3196,7 @@ type CreateImageResp struct { type UploadOsImageReq struct { ImageId string `form:"image_id" copier:"ImageId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type UploadOsImageResp struct { @@ -3207,7 +3207,7 @@ type UploadOsImageResp struct { type DeleteImageReq struct { ImageId string `form:"image_id" copier:"ImageId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type DeleteImageResp struct { @@ -3231,7 +3231,7 @@ type ImageNum struct { } type ListNetworksReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListNetworksResp struct { @@ -3271,7 +3271,7 @@ type Network struct { type DeleteNetworkReq struct { NetworkId string `form:"network_id" copier:"NetworkId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type DeleteNetworkResp struct { @@ -3282,7 +3282,7 @@ type DeleteNetworkResp struct { type CreateNetworkReq struct { Network CreateNetwork `json:"network" copier:"Network"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type CreateNetworkResp struct { @@ -3300,7 +3300,7 @@ type CreateNetwork struct { type CreateSubnetReq struct { Subnet Subnet `json:"subnet" copier:"Subnet"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type CreateSubnetResp struct { @@ -3355,7 +3355,7 @@ type Allocation_pools struct { type ShowNetworkDetailsReq struct { NetworkId string `form:"network_id" copier:"NetworkId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ShowNetworkDetailsResp struct { @@ -3394,7 +3394,7 @@ type Networkdetail struct { type UpdateNetworkReq struct { NetworkId string `form:"network_id" copier:"NetworkId"` Network Network `json:"network" copier:"Network"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type UpdateNetworkResp struct { @@ -3419,7 +3419,7 @@ type BulkCreateNetworksResp struct { type ListSubnetsReq struct { Limit int32 `json:"limit,optional"` OffSet int32 `json:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListSubnetsResp struct { @@ -3461,7 +3461,7 @@ type Allocation_pool struct { type DeleteSubnetReq struct { SubnetId string `json:"subnet_id,optional" copier:"subnetId"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type DeleteSubnetResp struct { @@ -3472,7 +3472,7 @@ type DeleteSubnetResp struct { type UpdateSubnetReq struct { SubnetId string `json:"subnet_id,optional" copier:"subnetId"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type UpdateSubnetResp struct { @@ -3517,7 +3517,7 @@ type Used struct { type ListNetworkSegmentRangesReq struct { Limit int32 `json:"limit,optional"` OffSet int32 `json:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListNetworkSegmentRangesResp struct { @@ -3547,7 +3547,7 @@ type Network_segment_ranges struct { type DeleteNetworkSegmentRangesReq struct { Network_segment_range_id string `json:"network_segment_range_id,optional" copier:"network_segment_range_id"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type DeleteNetworkSegmentRangesResp struct { @@ -3559,7 +3559,7 @@ type DeleteNetworkSegmentRangesResp struct { type UpdateNetworkSegmentRangesReq struct { Network_segment_range_id string `json:"network_segment_range_id,optional" copier:"network_segment_range_id"` NetworkSegmentRange Network_segment_range `json:"network_segment_range,optional" copier:"NetworkSegmentRange"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type UpdateNetworkSegmentRangesResp struct { @@ -3631,7 +3631,7 @@ type CreatePortResp struct { type ListPortsReq struct { Limit int32 `json:"limit,optional"` OffSet int32 `json:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListPortsResp struct { @@ -3690,7 +3690,7 @@ type Fixed_ips struct { type DeletePortReq struct { Port_id string `json:"port_id,optional" copier:"port_id"` - Platform string `json:"platform,optional" copier:"platform"` + Platform string `form:"platform,optional" copier:"platform"` } type DeletePortResp struct { @@ -3702,7 +3702,7 @@ type DeletePortResp struct { type UpdatePortReq struct { Port_id string `json:"port_id,optional" copier:"port_id"` Port Port `json:"port,optional" copier:"port"` - Platform string `json:"platform,optional" copier:"platform"` + Platform string `form:"platform,optional" copier:"platform"` } type UpdatePortResp struct { @@ -3715,7 +3715,7 @@ type UpdatePortResp struct { type ShowPortDetailsReq struct { Port_id string `json:"port_id,optional" copier:"port_id"` Fields string `json:"fields,optional" copier:"fields"` - Platform string `json:"platform,optional" copier:"platform"` + Platform string `form:"platform,optional" copier:"platform"` } type ShowPortDetailsResp struct { @@ -3728,7 +3728,7 @@ type ShowPortDetailsResp struct { type ListRoutersReq struct { Limit int32 `json:"limit,optional"` OffSet int32 `json:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListRoutersResp struct { @@ -3822,7 +3822,7 @@ type Router struct { type UpdateRouterReq struct { Router Router `json:"router,optional" copier:"router"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type UpdateRouterResp struct { @@ -3834,7 +3834,7 @@ type UpdateRouterResp struct { type ShowRouterDetailsReq struct { Router Router `json:"router,optional" copier:"router"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type ShowRouterDetailsResp struct { @@ -3845,7 +3845,7 @@ type ShowRouterDetailsResp struct { } type DeleteRouterReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Router_id string `json:"router_id,optional" copier:"router_id"` } @@ -3856,7 +3856,7 @@ type DeleteRouterResp struct { } type ListFloatingIPsReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Limit int32 `json:"limit,optional" copier:"Limit"` OffSet int32 `json:"offSet,optional" copier:"OffSet"` } @@ -3943,7 +3943,7 @@ type Floatingip struct { } type UpdateFloatingIPReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Floatingip_id string `json:"floatingip_id,optional" copier:"floatingip_id"` Floatingip Floatingip `json:"floatingip,optional" copier:"floatingip"` } @@ -3956,7 +3956,7 @@ type UpdateFloatingIPResp struct { } type DeleteFloatingIPReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Floatingip_id string `json:"floatingip_id,optional" copier:"floatingip_id"` } @@ -3979,7 +3979,7 @@ type ShowFloatingIPDetailsResp struct { } type ListFirewallGroupsReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Fields string `json:"fields,optional" copier:"fields"` } @@ -4006,7 +4006,7 @@ type Firewall_groups struct { type DeleteFirewallGroupReq struct { Firewall_group_id string `json:"firewall_group_id,optional" copier:"firewall_group_id"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type DeleteFirewallGroupResp struct { @@ -4043,7 +4043,7 @@ type Firewall_group struct { type UpdateFirewallGroupReq struct { Firewall_group Firewall_group `json:"firewall_group,optional" copier:"firewall_group"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Firewall_group_id string `json:"firewall_group_id,optional" copier:"firewall_group_id"` } @@ -4055,7 +4055,7 @@ type UpdateFirewallGroupResp struct { } type ShowFirewallGroupDetailsReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Firewall_group_id string `json:"firewall_group_id,optional" copier:"firewall_group_id"` } @@ -4090,7 +4090,7 @@ type Firewall_policy struct { } type DeleteFirewallPolicyReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Firewall_policy_id string `json:"firewall_policy_id,optional" copier:"firewall_policy_id"` } @@ -4101,7 +4101,7 @@ type DeleteFirewallPolicyResp struct { } type ListFirewallPoliciesReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Fields string `json:"fields,optional" copier:"fields"` } @@ -4167,7 +4167,7 @@ type Firewall_rule struct { } type DeleteFirewallRuleReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Firewall_rule_id string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"` } @@ -4178,7 +4178,7 @@ type DeleteFirewallRuleResp struct { } type ListFirewallRulesReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Fields string `json:"fields,optional" copier:"fields"` } @@ -4209,7 +4209,7 @@ type Firewall_rules struct { } type ShowFirewallRuleDetailsReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Firewall_rule_id string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"` } @@ -4221,7 +4221,7 @@ type ShowFirewallRuleDetailsResp struct { } type ListSecurityGroupsReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Fields string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"` } @@ -4247,7 +4247,7 @@ type Security_groups struct { } type CreateSecurityGroupReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Firewall_rule_id string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"` } @@ -4294,7 +4294,7 @@ type Security_group_rules struct { } type DeleteSecurityGroupReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Security_group_id string `json:"security_group_id,optional" copier:"security_group_id"` } @@ -4305,7 +4305,7 @@ type DeleteSecurityGroupResp struct { } type UpdateSecurityGroupReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Security_group_id string `json:"security_group_id,optional" copier:"security_group_id"` } @@ -4317,7 +4317,7 @@ type UpdateSecurityGroupResp struct { } type ShowSecurityGroupReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Security_group_id string `json:"security_group_id,optional" copier:"security_group_id"` Fields string `json:"fields,optional" copier:"fields"` Verbose string `json:"verbose,optional" copier:"verbose"` @@ -4331,7 +4331,7 @@ type ShowSecurityGroupResp struct { } type ListSecurityGroupRulesReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type ListSecurityGroupRulesResp struct { @@ -4373,7 +4373,7 @@ type Security_group_rule struct { } type ShowSecurityGroupRuleReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Security_group_rule_id string `json:"security_group_rule_id,optional" copier:"security_group_rule_id"` } @@ -4385,7 +4385,7 @@ type ShowSecurityGroupRuleResp struct { } type DeleteSecurityGroupRuleReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Security_group_rule_id string `json:"security_group_rule_id,optional" copier:"security_group_rule_id"` } @@ -4397,7 +4397,7 @@ type DeleteSecurityGroupRuleResp struct { } type ListVolumesDetailReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListVolumesDetailResp struct { @@ -4431,7 +4431,7 @@ type DeleteVolumeReq struct { VolumeId string `form:"volume_id" copier:"VolumeId"` Cascade bool `json:"cascade" copier:"Cascade"` Force bool `json:"force" copier:"force"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type DeleteVolumeResp struct { @@ -4481,7 +4481,7 @@ type VolumeResp struct { } type ListVolumeTypesReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListVolumeTypesResp struct { @@ -4508,7 +4508,7 @@ type Extra_specs struct { type UpdateVolumeReq struct { Volume Volume `json:"volume" copier:"Volume"` VolumeId string `json:"volume_id" copier:"VolumeId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type UpdateVolumeResp struct { @@ -4520,7 +4520,7 @@ type UpdateVolumeResp struct { type GetVolumeDetailedByIdReq struct { VolumeId string `form:"volume_id" copier:"VolumeId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type GetVolumeDetailedByIdResp struct { @@ -4572,7 +4572,7 @@ type VolumeType struct { type DeleteVolumeTypeReq struct { VolumeTypeId string `json:"volume_type_id" copier:"VolumeTypeId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type DeleteVolumeTypeResp struct { @@ -4592,7 +4592,7 @@ type ListVolumesReq struct { CreatedAt string `json:"created_at" copier:"CreatedAt"` ConsumesQuota bool `json:"consumes_quota" copier:"ConsumesQuota"` UpdatedAt string `json:"updated_at" copier:"UpdatedAt"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListVolumesResp struct { @@ -4609,7 +4609,7 @@ type VolumesList struct { } type ListFlavorsDetailReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListFlavorsDetailResp struct { @@ -4634,7 +4634,7 @@ type Flavors struct { } type ListNodesReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` Limit int64 `json:"limit" copier:"Limit"` Marker string `json:"marker" copier:"Marker"` SortDir string `json:"sort_dir" copier:"SortDir"` From 45b483566bd30a4c368bd9b9a43b7f59f8400d59 Mon Sep 17 00:00:00 2001 From: zhouqunjie Date: Mon, 25 Mar 2024 15:11:40 +0800 Subject: [PATCH 08/15] submit hpc task Former-commit-id: dbe3f6554b47591a595279e4a60b8742a13da1d1 --- api/client/task.go | 28 ----- api/client/types.go | 28 +++++ api/desc/hpc/pcm-hpc.api | 30 ++--- api/desc/participant/pcm-participant.api | 125 +++++++++++++++++++ api/desc/pcm.api | 13 +- api/internal/handler/routes.go | 10 ++ api/internal/logic/core/pulltaskinfologic.go | 23 +--- api/internal/logic/core/pushtaskinfologic.go | 2 +- api/internal/logic/hpc/commithpctasklogic.go | 25 +++- api/internal/types/types.go | 43 ++++--- 10 files changed, 238 insertions(+), 89 deletions(-) create mode 100644 api/desc/participant/pcm-participant.api diff --git a/api/client/task.go b/api/client/task.go index 086249f7..3367ab95 100644 --- a/api/client/task.go +++ b/api/client/task.go @@ -11,31 +11,3 @@ type Task interface { PushTaskInfo(pushTaskInfoReq PushTaskInfoReq) (*PushTaskInfoResp, error) PushResourceInfo(pushResourceInfoReq PushResourceInfoReq) error } - -type PullTaskInfoReq struct { - AdapterId int64 `json:"adapterId"` -} - -type PullTaskInfoResp struct { - HpcInfoList []*HpcInfo `json:"HpcInfoList,omitempty"` - CloudInfoList []*CloudInfo `json:"CloudInfoList,omitempty"` - AiInfoList []*AiInfo `json:"AiInfoList,omitempty"` - VmInfoList []*VmInfo `json:"VmInfoList,omitempty"` -} - -type PushTaskInfoReq struct { - AdapterId int64 `json:"adapterId"` - HpcInfoList []*HpcInfo - CloudInfoList []*CloudInfo - AiInfoList []*AiInfo - VmInfoList []*VmInfo -} - -type PushTaskInfoResp struct { - Code int64 - Msg string -} - -type PushResourceInfoReq struct { - AdapterId int64 `json:"adapterId"` -} diff --git a/api/client/types.go b/api/client/types.go index 155ad628..758f6bcb 100644 --- a/api/client/types.go +++ b/api/client/types.go @@ -5,6 +5,34 @@ import ( "time" ) +type PullTaskInfoReq struct { + AdapterId int64 `form:"adapterId"` +} + +type PullTaskInfoResp struct { + HpcInfoList []*HpcInfo `json:"HpcInfoList,omitempty"` + CloudInfoList []*CloudInfo `json:"CloudInfoList,omitempty"` + AiInfoList []*AiInfo `json:"AiInfoList,omitempty"` + VmInfoList []*VmInfo `json:"VmInfoList,omitempty"` +} + +type PushTaskInfoReq struct { + AdapterId int64 `json:"adapterId"` + HpcInfoList []*HpcInfo `json:"HpcInfoList,omitempty,optional"` + CloudInfoList []*CloudInfo `json:"CloudInfoList,omitempty,optional"` + AiInfoList []*AiInfo `json:"AiInfoList,omitempty,optional"` + VmInfoList []*VmInfo `json:"VmInfoList,omitempty,optional"` +} + +type PushTaskInfoResp struct { + Code int64 + Msg string +} + +type PushResourceInfoReq struct { + AdapterId int64 `json:"adapterId"` +} + type HpcInfo struct { Id int64 `json:"id"` // id TaskId int64 `json:"task_id"` // 任务id diff --git a/api/desc/hpc/pcm-hpc.api b/api/desc/hpc/pcm-hpc.api index 38f0ed08..23bb516c 100644 --- a/api/desc/hpc/pcm-hpc.api +++ b/api/desc/hpc/pcm-hpc.api @@ -23,21 +23,21 @@ type ( Description string `json:"description,optional"` tenantId int64 `json:"tenantId,optional"` TaskId int64 `json:"taskId,optional"` - participantId int64 `json:"participantId,optional"` - matchLabels map[string]string `json:"matchLabels,optional"` - cardCount int64 `json:"cardCount,optional"` - workDir string `json:"workDir,optional"` //paratera:workingDir - wallTime string `json:"wallTime,optional"` - cmdScript string `json:"cmdScript,optional"` // paratera:bootScript - appType string `json:"appType,optional"` - appName string `json:"appName,optional"` // paratera:jobGroupName ac:appname - queue string `json:"queue,optional"` - nNode string `json:"nNode,optional"` - submitType string `json:"submitType,optional"` - stdOutFile string `json:"stdOutFile,optional"` - stdErrFile string `json:"stdErrFile,optional"` - stdInput string `json:"stdInput,optional"` - environment map[string]string `json:"environment,optional"` + AdapterId int64 `json:"adapterId,optional"` + MatchLabels map[string]string `json:"matchLabels,optional"` + CardCount int64 `json:"cardCount,optional"` + WorkDir string `json:"workDir,optional"` //paratera:workingDir + WallTime string `json:"wallTime,optional"` + CmdScript string `json:"cmdScript,optional"` // paratera:bootScript + AppType string `json:"appType,optional"` + AppName string `json:"appName,optional"` // paratera:jobGroupName ac:appname + Queue string `json:"queue,optional"` + NNode string `json:"nNode,optional"` + SubmitType string `json:"submitType,optional"` + StdOutFile string `json:"stdOutFile,optional"` + StdErrFile string `json:"stdErrFile,optional"` + StdInput string `json:"stdInput,optional"` + Environment map[string]string `json:"environment,optional"` } ) diff --git a/api/desc/participant/pcm-participant.api b/api/desc/participant/pcm-participant.api new file mode 100644 index 00000000..f76fc604 --- /dev/null +++ b/api/desc/participant/pcm-participant.api @@ -0,0 +1,125 @@ +syntax = "v1" + +info( + title: "type title here" + desc: "type desc here" + author: "type author here" + email: "type email here" + version: "type version here" +) + +type PullTaskInfoReq { + AdapterId int64 `form:"adapterId"` +} + +type PullTaskInfoResp struct { + HpcInfoList []*HpcInfo `json:"HpcInfoList,omitempty"` + CloudInfoList []*CloudInfo `json:"CloudInfoList,omitempty"` + AiInfoList []*AiInfo `json:"AiInfoList,omitempty"` + VmInfoList []*VmInfo `json:"VmInfoList,omitempty"` +} + +type HpcInfo struct { + Id int64 `json:"id"` // id + TaskId int64 `json:"task_id"` // 任务id + JobId string `json:"job_id"` // 作业id(在第三方系统中的作业id) + ClusterId int64 `json:"cluster_id"` // 执行任务的集群id + ClusterType string `json:"cluster_type"` // 执行任务的集群类型 + Name string `json:"name"` // 名称 + Status string `json:"status"` // 状态 + CmdScript string `json:"cmd_script"` + StartTime string `json:"start_time"` // 开始时间 + RunningTime int64 `json:"running_time"` // 运行时间 + DerivedEs string `json:"derived_es"` + Cluster string `json:"cluster"` + BlockId int64 `json:"block_id"` + AllocNodes int64 `json:"alloc_nodes"` + AllocCpu int64 `json:"alloc_cpu"` + CardCount int64 `json:"card_count"` // 卡数 + Version string `json:"version"` + Account string `json:"account"` + WorkDir string `json:"work_dir"` // 工作路径 + AssocId int64 `json:"assoc_id"` + ExitCode int64 `json:"exit_code"` + WallTime string `json:"wall_time"` // 最大运行时间 + Result string `json:"result"` // 运行结果 + DeletedAt string `json:"deleted_at"` // 删除时间 + YamlString string `json:"yaml_string"` + AppType string `json:"app_type"` // 应用类型 + AppName string `json:"app_name"` // 应用名称 + Queue string `json:"queue"` // 队列名称 + SubmitType string `json:"submit_type"` // cmd(命令行模式) + NNode string `json:"n_node"` // 节点个数(当指定该参数时,GAP_NODE_STRING必须为"") + StdOutFile string `json:"std_out_file"` // 工作路径/std.err.%j + StdErrFile string `json:"std_err_file"` // 工作路径/std.err.%j + StdInput string `json:"std_input"` + Environment string `json:"environment"` + DeletedFlag int64 `json:"deleted_flag"` // 是否删除(0-否,1-是) + CreatedBy int64 `json:"created_by"` // 创建人 + CreatedTime string `json:"created_time"` // 创建时间 + UpdatedBy int64 `json:"updated_by"` // 更新人 + UpdatedTime string `json:"updated_time"` // 更新时间 +} + +type CloudInfo struct { + Participant int64 `json:"participant,omitempty"` + Id int64 `json:"id,omitempty"` + TaskId int64 `json:"taskId,omitempty"` + ApiVersion string `json:"apiVersion,omitempty"` + Kind string `json:"kind,omitempty"` + Namespace string `json:"namespace,omitempty"` + Name string `json:"name,omitempty"` + Status string `json:"status,omitempty"` + StartTime string `json:"startTime,omitempty"` + RunningTime int64 `json:"runningTime,omitempty"` + Result string `json:"result,omitempty"` + YamlString string `json:"yamlString,omitempty"` +} + +type AiInfo struct { + ParticipantId int64 `json:"participantId,omitempty"` + TaskId int64 `json:"taskId,omitempty"` + ProjectId string `json:"project_id,omitempty"` + Name string `json:"name,omitempty"` + Status string `json:"status,omitempty"` + StartTime string `json:"startTime,omitempty"` + RunningTime int64 `json:"runningTime,omitempty"` + Result string `json:"result,omitempty"` + JobId string `json:"jobId,omitempty"` + CreateTime string `json:"createTime,omitempty"` + ImageUrl string `json:"imageUrl,omitempty"` + Command string `json:"command,omitempty"` + FlavorId string `json:"flavorId,omitempty"` + SubscriptionId string `json:"subscriptionId,omitempty"` + ItemVersionId string `json:"itemVersionId,omitempty"` +} + +type VmInfo struct { + ParticipantId int64 `json:"participantId,omitempty"` + TaskId int64 `json:"taskId,omitempty"` + Name string `json:"name,omitempty"` + FlavorRef string `json:"flavor_ref,omitempty"` + ImageRef string `json:"image_ref,omitempty"` + NetworkUuid string `json:"network_uuid,omitempty"` + BlockUuid string `json:"block_uuid,omitempty"` + SourceType string `json:"source_type,omitempty"` + DeleteOnTermination bool `json:"delete_on_termination,omitempty"` + State string `json:"state,omitempty"` +} + +type PushTaskInfoReq struct { + AdapterId int64 `json:"adapterId"` + HpcInfoList []*HpcInfo + CloudInfoList []*CloudInfo + AiInfoList []*AiInfo + VmInfoList []*VmInfo +} + +type PushTaskInfoResp struct { + Code int64 + Msg string +} + +type PushResourceInfoReq struct { + AdapterId int64 `json:"adapterId"` +} \ No newline at end of file diff --git a/api/desc/pcm.api b/api/desc/pcm.api index dca9d708..df0d8643 100644 --- a/api/desc/pcm.api +++ b/api/desc/pcm.api @@ -9,6 +9,7 @@ import ( "cloud/pcm-cloud.api" "storelink/pcm-storelink.api" "schedule/pcm-schedule.api" + "participant/pcm-participant.api" ) info( @@ -112,6 +113,14 @@ service pcm { @doc "metrics" @handler metricsHandler get /core/metrics + + @doc "provided to participant to pull task info from core" + @handler pullTaskInfoHandler + get /core/pullTaskInfo (PullTaskInfoReq) returns (PullTaskInfoResp) + + @doc "provided to participant to push task info to core" + @handler pushTaskInfoHandler + post /core/pushTaskInfo (PushTaskInfoReq) returns (PushTaskInfoResp) } //hpc二级接口 @@ -292,9 +301,9 @@ service pcm { @doc "挂载notebook存储" @handler mountNotebookStorageHandler post /ai/mountNotebookStorage (MountNotebookStorageReq) returns (MountNotebookStorageResp) - /******************Notebook Method end*************************/ +/******************Notebook Method end*************************/ - /******************Visualization Job Method start*************************/ +/******************Visualization Job Method start*************************/ @doc "获取虚拟化任务" @handler getVisualizationJobHandler get /ai/getVisualizationJob (GetVisualizationJobReq) returns (GetVisualizationJobResp) diff --git a/api/internal/handler/routes.go b/api/internal/handler/routes.go index 6822d544..50f31d6c 100644 --- a/api/internal/handler/routes.go +++ b/api/internal/handler/routes.go @@ -134,6 +134,16 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { Path: "/core/metrics", Handler: core.MetricsHandler(serverCtx), }, + { + Method: http.MethodGet, + Path: "/core/pullTaskInfo", + Handler: core.PullTaskInfoHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/core/pushTaskInfo", + Handler: core.PushTaskInfoHandler(serverCtx), + }, }, rest.WithPrefix("/pcm/v1"), ) diff --git a/api/internal/logic/core/pulltaskinfologic.go b/api/internal/logic/core/pulltaskinfologic.go index 438475d4..bc152ddc 100644 --- a/api/internal/logic/core/pulltaskinfologic.go +++ b/api/internal/logic/core/pulltaskinfologic.go @@ -27,26 +27,12 @@ func NewPullTaskInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Pull } func (l *PullTaskInfoLogic) PullTaskInfo(req *clientCore.PullTaskInfoReq) (*clientCore.PullTaskInfoResp, error) { - //opt := clientPCM.Options{ - // Url: "http://localhost:8999", - // DataSource: "root:uJpLd6u-J?HC1@(47.92.88.143:3306)/pcm?parseTime=true&loc=Local", - //} - //coreCli, _ := clientPCM.NewClient(opt) - //taskOpt := clientPCM.TaskOptions{} - //coreTask, _ := coreCli.Task(taskOpt) - //adapterId := 1706858330967773111 - //// 查询core端分发下来的任务列表 - //pullReq := types.PullTaskInfoReq{ - // AdapterId: int64(adapterId), - //} - //hpcList, _ := coreTask.PullTaskInfo(pullReq) - //println(hpcList) - // 查询p端类型 resp := clientCore.PullTaskInfoResp{} + // check the kind of adapter var kind int32 l.svcCtx.DbEngin.Raw("select type as kind from `t_adapter` where id = ?", req.AdapterId).Scan(&kind) - // 查询云智超中的数据列表 + // pull task list from database switch kind { case 2: var hpcModelList []models.TaskHpc @@ -85,8 +71,9 @@ func (l *PullTaskInfoLogic) PullTaskInfo(req *clientCore.PullTaskInfoReq) (*clie return &resp, nil } -func findModelList(participantId int64, dbEngin *gorm.DB, data interface{}) error { - tx := dbEngin.Where("cluster_id = (select id from t_cluster where adapter_id = ?) AND status NOT IN ?", participantId, []string{"Deleted", "Succeeded", "Completed", "Failed"}).Find(data) +func findModelList(adapterId int64, dbEngin *gorm.DB, data interface{}) error { + tx := dbEngin.Where("cluster_id in (select id from t_cluster where adapter_id = ?) AND status not in "+ + "('Deleted', 'Succeeded', 'COMPLETED', 'Completed', 'Failed','FAIL','statC','statE')", adapterId).Find(data) if tx.Error != nil { return tx.Error } diff --git a/api/internal/logic/core/pushtaskinfologic.go b/api/internal/logic/core/pushtaskinfologic.go index 6a882aee..2944711d 100644 --- a/api/internal/logic/core/pushtaskinfologic.go +++ b/api/internal/logic/core/pushtaskinfologic.go @@ -40,7 +40,7 @@ func (l *PushTaskInfoLogic) PushTaskInfo(req *clientCore.PushTaskInfoReq) (*clie case 2: for _, hpcInfo := range req.HpcInfoList { l.svcCtx.DbEngin.Exec("update task_hpc set status = ?,start_time = ?,job_id = ? where cluster_id = ? and task_id = ? and name = ?", - hpcInfo.Status, hpcInfo.StartTime, hpcInfo.RunningTime, hpcInfo.JobId, req.AdapterId, hpcInfo.TaskId, hpcInfo.Name) + hpcInfo.Status, hpcInfo.StartTime, hpcInfo.JobId, hpcInfo.ClusterId, hpcInfo.TaskId, hpcInfo.Name) syncTask(l.svcCtx.DbEngin, hpcInfo.TaskId) } case 1: diff --git a/api/internal/logic/hpc/commithpctasklogic.go b/api/internal/logic/hpc/commithpctasklogic.go index d8827ce9..6211a13d 100644 --- a/api/internal/logic/hpc/commithpctasklogic.go +++ b/api/internal/logic/hpc/commithpctasklogic.go @@ -5,6 +5,7 @@ import ( "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants" "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models" "k8s.io/apimachinery/pkg/util/json" + "math/rand" "time" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" @@ -28,6 +29,7 @@ func NewCommitHpcTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Com } func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *types.CommitHpcTaskResp, err error) { + // 构建主任务结构体 taskModel := models.Task{ Status: constants.Saved, @@ -41,10 +43,18 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t return nil, tx.Error } + var clusterIds []int64 + l.svcCtx.DbEngin.Raw("SELECT id FROM `t_cluster` where adapter_id = ? and label = ?", req.AdapterId, req.ClusterType).Scan(&clusterIds) + env, _ := json.Marshal(req.Environment) + + if len(clusterIds) == 0 || clusterIds == nil { + return nil, nil + } + hpcInfo := models.TaskHpc{ TaskId: taskModel.Id, - ClusterId: 1706858330967773111, + ClusterId: clusterIds[rand.Intn(len(clusterIds))], Name: taskModel.Name, Status: "Saved", CmdScript: req.CmdScript, @@ -61,9 +71,9 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t StdErrFile: req.StdErrFile, StdInput: req.StdInput, DeletedFlag: 0, - CreatedBy: req.ParticipantId, + CreatedBy: 0, CreatedTime: time.Now(), - UpdatedBy: req.ParticipantId, + UpdatedBy: 0, UpdatedTime: time.Now(), Environment: string(env), } @@ -72,7 +82,7 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t if tx.Error != nil { return nil, tx.Error } - // 将任务数据转换成消息体 + // todo mq task manage //reqMessage, err := json.Marshal(mqInfo) //if err != nil { // logx.Error(err) @@ -82,5 +92,10 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t //if publish.Err() != nil { // return nil, publish.Err() //} - return + resp = &types.CommitHpcTaskResp{ + Code: 200, + Msg: "success", + TaskId: taskModel.Id, + } + return resp, nil } diff --git a/api/internal/types/types.go b/api/internal/types/types.go index 17307edd..6f165681 100644 --- a/api/internal/types/types.go +++ b/api/internal/types/types.go @@ -849,29 +849,32 @@ type Job struct { } type CommitHpcTaskReq struct { - Name string `json:"name"` // paratera:jobName - Description string `json:"description,optional"` - TenantId int64 `json:"tenantId,optional"` - TaskId int64 `json:"taskId,optional"` - ParticipantId int64 `json:"participantId,optional"` - MatchLabels map[string]string `json:"matchLabels,optional"` - CardCount int64 `json:"cardCount,optional"` - WorkDir string `json:"workDir,optional"` //paratera:workingDir - WallTime string `json:"wallTime,optional"` - CmdScript string `json:"cmdScript,optional"` // paratera:bootScript - AppType string `json:"appType,optional"` - AppName string `json:"appName,optional"` // paratera:jobGroupName ac:appname - Queue string `json:"queue,optional"` - NNode string `json:"nNode,optional"` - SubmitType string `json:"submitType,optional"` - StdOutFile string `json:"stdOutFile,optional"` - StdErrFile string `json:"stdErrFile,optional"` - StdInput string `json:"stdInput,optional"` - Environment map[string]string `json:"environment,optional"` + Name string `json:"name"` // paratera:jobName + Description string `json:"description,optional"` + TenantId int64 `json:"tenantId,optional"` + TaskId int64 `json:"taskId,optional"` + AdapterId int64 `json:"adapterId,optional"` + ClusterType string `json:"clusterType,optional"` + MatchLabels map[string]string `json:"matchLabels,optional"` + CardCount int64 `json:"cardCount,optional"` + WorkDir string `json:"workDir,optional"` //paratera:workingDir + WallTime string `json:"wallTime,optional"` + CmdScript string `json:"cmdScript,optional"` // paratera:bootScript + AppType string `json:"appType,optional"` + AppName string `json:"appName,optional"` // paratera:jobGroupName ac:appname + Queue string `json:"queue,optional"` + NNode string `json:"nNode,optional"` + SubmitType string `json:"submitType,optional"` + StdOutFile string `json:"stdOutFile,optional"` + StdErrFile string `json:"stdErrFile,optional"` + StdInput string `json:"stdInput,optional"` + Environment map[string]string `json:"environment,optional"` } type CommitHpcTaskResp struct { - TaskId int64 `json:"taskId"` + Code int32 `json:"code"` + Msg string `json:"msg"` + TaskId int64 `json:"taskId"` } type ListJobReq struct { From eb2d695cbcf1e3bbf2cf750ba817fb09b0ad6265 Mon Sep 17 00:00:00 2001 From: qiwang <1364512070@qq.com> Date: Mon, 25 Mar 2024 19:09:15 +0800 Subject: [PATCH 09/15] fix:Modify configuration file fields Former-commit-id: ecd908cee464900c0d86d0dd10efebb3eed88469 --- api/desc/participant/pcm-participant.api | 12 +- api/desc/pcm.api | 4 +- api/desc/vm/pcm-vm.api | 4 +- .../handler/adapters/adapterslisthandler.go | 12 +- .../handler/adapters/clusterlisthandler.go | 12 +- .../handler/adapters/createadapterhandler.go | 12 +- .../handler/adapters/createclusterhandler.go | 12 +- .../handler/adapters/deleteadapterhandler.go | 12 +- .../handler/adapters/deleteclusterhandler.go | 12 +- .../handler/adapters/getadapterhandler.go | 12 +- .../adapters/getadapterrelationhandler.go | 12 +- .../handler/adapters/getclusterhandler.go | 12 +- .../handler/adapters/getclustersumhandler.go | 12 +- .../handler/adapters/updateadapterhandler.go | 12 +- .../handler/adapters/updateclusterhandler.go | 12 +- .../handler/core/centerresourceshandler.go | 8 +- .../handler/core/committaskhandler.go | 7 +- .../handler/core/commitvmtaskhandler.go | 12 +- .../handler/core/deletetaskhandler.go | 21 +-- .../core/getcomputilitystatisticshandler.go | 14 -- .../handler/core/getcomputingpowerhandler.go | 14 -- .../handler/core/getgeneralinfohandler.go | 14 -- api/internal/handler/core/getregionhandler.go | 14 -- .../core/getresourcepanelconfighandler.go | 23 +--- api/internal/handler/core/jobtotalhandler.go | 22 +-- .../handler/core/listcenterhandler.go | 14 -- .../handler/core/listclusterhandler.go | 14 -- .../handler/core/listdomainresourcehandler.go | 23 +--- .../handler/core/listregionhandler.go | 14 -- api/internal/handler/core/metricshandler.go | 13 +- .../handler/core/nodeassetshandler.go | 22 +-- .../handler/core/participantlisthandler.go | 22 +-- .../handler/core/pulltaskinfohandler.go | 4 +- .../handler/core/pushtaskinfohandler.go | 4 +- .../core/putresourcepanelconfighandler.go | 24 +--- .../handler/core/scheduletaskbyyamlhandler.go | 38 ++---- .../handler/core/syncclusterloadhandler.go | 7 +- .../handler/core/taskdetailhandler.go | 21 +-- api/internal/handler/core/tasklisthandler.go | 14 -- .../handler/dictionary/adddicthandler.go | 12 +- .../handler/dictionary/adddictitemhandler.go | 12 +- .../handler/dictionary/deletedicthandler.go | 12 +- .../dictionary/deletedictitemhandler.go | 12 +- .../handler/dictionary/editdicthandler.go | 12 +- .../handler/dictionary/editdictitemhandler.go | 12 +- .../handler/dictionary/getdicthandler.go | 12 +- .../handler/dictionary/getdictitemhandler.go | 12 +- .../handler/dictionary/listdicthandler.go | 12 +- .../dictionary/listdictitembycodehandler.go | 12 +- .../handler/dictionary/listdictitemhandler.go | 12 +- api/internal/types/types.go | 125 +++++++++++++++++- 51 files changed, 408 insertions(+), 396 deletions(-) diff --git a/api/desc/participant/pcm-participant.api b/api/desc/participant/pcm-participant.api index f76fc604..f77be78e 100644 --- a/api/desc/participant/pcm-participant.api +++ b/api/desc/participant/pcm-participant.api @@ -109,15 +109,15 @@ type VmInfo struct { type PushTaskInfoReq struct { AdapterId int64 `json:"adapterId"` - HpcInfoList []*HpcInfo - CloudInfoList []*CloudInfo - AiInfoList []*AiInfo - VmInfoList []*VmInfo + HpcInfoList []*HpcInfo `json:"hpcInfoList"` + CloudInfoList []*CloudInfo `json:"cloudInfoList"` + AiInfoList []*AiInfo `json:"aiInfoList"` + VmInfoList []*VmInfo `json:"vmInfoList"` } type PushTaskInfoResp struct { - Code int64 - Msg string + Code int64 `json:"code"` + Msg string `json:"msg"` } type PushResourceInfoReq struct { diff --git a/api/desc/pcm.api b/api/desc/pcm.api index df0d8643..63fe0d68 100644 --- a/api/desc/pcm.api +++ b/api/desc/pcm.api @@ -301,9 +301,9 @@ service pcm { @doc "挂载notebook存储" @handler mountNotebookStorageHandler post /ai/mountNotebookStorage (MountNotebookStorageReq) returns (MountNotebookStorageResp) -/******************Notebook Method end*************************/ + /******************Notebook Method end*************************/ -/******************Visualization Job Method start*************************/ + /******************Visualization Job Method start*************************/ @doc "获取虚拟化任务" @handler getVisualizationJobHandler get /ai/getVisualizationJob (GetVisualizationJobReq) returns (GetVisualizationJobResp) diff --git a/api/desc/vm/pcm-vm.api b/api/desc/vm/pcm-vm.api index 5640456b..cb605840 100644 --- a/api/desc/vm/pcm-vm.api +++ b/api/desc/vm/pcm-vm.api @@ -332,10 +332,12 @@ type ( Server { Name string `json:"name,optional" copier:"Name"` FlavorRef string `json:"flavorRef,optional" copier:"FlavorRef"` + Description string `json:"description,optional" copier:"Description"` ImageRef string `json:"imageRef,optional" copier:"ImageRef"` Networks []CreNetwork `json:"networks,optional" copier:"Networks"` //AdminPass string `json:"adminPass" copier:"AdminPass"` BlockDeviceMappingV2 []Block_device_mapping_v2 `json:"block_device_mapping_v2,optional" copier:"BlockDeviceMappingV2"` + MinCount int32 `json:"min_count,optional" copier:"MinCount"` } CreNetwork { Uuid string `json:"uuid" copier:"Uuid"` @@ -714,7 +716,7 @@ type ( Ipv6AddressScope string `json:"ipv6_address_scope,optional" copier:"Ipv6AddressScope"` L2Adjacency bool `json:"l2_adjacency,optional" copier:"L2Adjacency"` Mtu int64 `json:"mtu,optional" copier:"Mtu"` - Name string `json:",optional" copier:"Name"` + Name string `json:"name,optional" copier:"Name"` PortSecurityEnabled bool `json:"port_security_enabled,optional" copier:"PortSecurityEnabled"` ProjectId string `json:"project_id,optional" copier:"ProjectId"` QosPolicyId string `json:"qos_policy_id,optional" copier:"QosPolicyId"` diff --git a/api/internal/handler/adapters/adapterslisthandler.go b/api/internal/handler/adapters/adapterslisthandler.go index 6ae5c320..3d84c0c8 100644 --- a/api/internal/handler/adapters/adapterslisthandler.go +++ b/api/internal/handler/adapters/adapterslisthandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func AdaptersListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AdapterQueryReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewAdaptersListLogic(r.Context(), svcCtx) resp, err := l.AdaptersList(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/clusterlisthandler.go b/api/internal/handler/adapters/clusterlisthandler.go index bf168fbc..f1863304 100644 --- a/api/internal/handler/adapters/clusterlisthandler.go +++ b/api/internal/handler/adapters/clusterlisthandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func ClusterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ClusterReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewClusterListLogic(r.Context(), svcCtx) resp, err := l.ClusterList(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/createadapterhandler.go b/api/internal/handler/adapters/createadapterhandler.go index be20ca49..42b60968 100644 --- a/api/internal/handler/adapters/createadapterhandler.go +++ b/api/internal/handler/adapters/createadapterhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func CreateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AdapterCreateReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewCreateAdapterLogic(r.Context(), svcCtx) resp, err := l.CreateAdapter(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/createclusterhandler.go b/api/internal/handler/adapters/createclusterhandler.go index 47e1e8b6..80eaa0de 100644 --- a/api/internal/handler/adapters/createclusterhandler.go +++ b/api/internal/handler/adapters/createclusterhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func CreateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ClusterCreateReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewCreateClusterLogic(r.Context(), svcCtx) resp, err := l.CreateCluster(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/deleteadapterhandler.go b/api/internal/handler/adapters/deleteadapterhandler.go index 3b2fb374..b2e1c7ca 100644 --- a/api/internal/handler/adapters/deleteadapterhandler.go +++ b/api/internal/handler/adapters/deleteadapterhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func DeleteAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AdapterDelReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewDeleteAdapterLogic(r.Context(), svcCtx) resp, err := l.DeleteAdapter(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/deleteclusterhandler.go b/api/internal/handler/adapters/deleteclusterhandler.go index 2f9d3c9e..62e800f1 100644 --- a/api/internal/handler/adapters/deleteclusterhandler.go +++ b/api/internal/handler/adapters/deleteclusterhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func DeleteClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.FId if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewDeleteClusterLogic(r.Context(), svcCtx) resp, err := l.DeleteCluster(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/getadapterhandler.go b/api/internal/handler/adapters/getadapterhandler.go index 3967cc56..2e4e189d 100644 --- a/api/internal/handler/adapters/getadapterhandler.go +++ b/api/internal/handler/adapters/getadapterhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func GetAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AdapterDelReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewGetAdapterLogic(r.Context(), svcCtx) resp, err := l.GetAdapter(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/getadapterrelationhandler.go b/api/internal/handler/adapters/getadapterrelationhandler.go index 1f265676..13212c35 100644 --- a/api/internal/handler/adapters/getadapterrelationhandler.go +++ b/api/internal/handler/adapters/getadapterrelationhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func GetAdapterRelationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AdapterRelationQueryReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewGetAdapterRelationLogic(r.Context(), svcCtx) resp, err := l.GetAdapterRelation(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/getclusterhandler.go b/api/internal/handler/adapters/getclusterhandler.go index 7fe828e9..865e861f 100644 --- a/api/internal/handler/adapters/getclusterhandler.go +++ b/api/internal/handler/adapters/getclusterhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func GetClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.FId if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewGetClusterLogic(r.Context(), svcCtx) resp, err := l.GetCluster(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/getclustersumhandler.go b/api/internal/handler/adapters/getclustersumhandler.go index bcd6d6af..18fd747e 100644 --- a/api/internal/handler/adapters/getclustersumhandler.go +++ b/api/internal/handler/adapters/getclustersumhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func GetClusterSumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ClusterSumReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewGetClusterSumLogic(r.Context(), svcCtx) resp, err := l.GetClusterSum(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/updateadapterhandler.go b/api/internal/handler/adapters/updateadapterhandler.go index 2f9ee8fa..3800fc16 100644 --- a/api/internal/handler/adapters/updateadapterhandler.go +++ b/api/internal/handler/adapters/updateadapterhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func UpdateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AdapterReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewUpdateAdapterLogic(r.Context(), svcCtx) resp, err := l.UpdateAdapter(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/adapters/updateclusterhandler.go b/api/internal/handler/adapters/updateclusterhandler.go index 197d0198..f5405d64 100644 --- a/api/internal/handler/adapters/updateclusterhandler.go +++ b/api/internal/handler/adapters/updateclusterhandler.go @@ -1,24 +1,28 @@ package adapters import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func UpdateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ClusterCreateReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := adapters.NewUpdateClusterLogic(r.Context(), svcCtx) resp, err := l.UpdateCluster(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/core/centerresourceshandler.go b/api/internal/handler/core/centerresourceshandler.go index c8ff2014..6c7ae71e 100644 --- a/api/internal/handler/core/centerresourceshandler.go +++ b/api/internal/handler/core/centerresourceshandler.go @@ -1,9 +1,9 @@ package core import ( - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" ) @@ -12,6 +12,10 @@ func CenterResourcesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := core.NewCenterResourcesLogic(r.Context(), svcCtx) resp, err := l.CenterResources() - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/core/committaskhandler.go b/api/internal/handler/core/committaskhandler.go index 1930c2d0..3bea0b93 100644 --- a/api/internal/handler/core/committaskhandler.go +++ b/api/internal/handler/core/committaskhandler.go @@ -1,7 +1,6 @@ package core import ( - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" "net/http" "github.com/zeromicro/go-zero/rest/httpx" @@ -20,6 +19,10 @@ func CommitTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { l := core.NewCommitTaskLogic(r.Context(), svcCtx) err := l.CommitTask(&req) - result.HttpResult(r, w, nil, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } } } diff --git a/api/internal/handler/core/commitvmtaskhandler.go b/api/internal/handler/core/commitvmtaskhandler.go index 7f8ab825..f2ca9e4b 100644 --- a/api/internal/handler/core/commitvmtaskhandler.go +++ b/api/internal/handler/core/commitvmtaskhandler.go @@ -1,24 +1,28 @@ package core import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func CommitVmTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CommitVmTaskReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := core.NewCommitVmTaskLogic(r.Context(), svcCtx) resp, err := l.CommitVmTask(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/core/deletetaskhandler.go b/api/internal/handler/core/deletetaskhandler.go index 08430798..e5a735e0 100644 --- a/api/internal/handler/core/deletetaskhandler.go +++ b/api/internal/handler/core/deletetaskhandler.go @@ -1,21 +1,6 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" "net/http" "github.com/zeromicro/go-zero/rest/httpx" @@ -34,6 +19,10 @@ func DeleteTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { l := core.NewDeleteTaskLogic(r.Context(), svcCtx) err := l.DeleteTask(&req) - result.HttpResult(r, w, nil, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } } } diff --git a/api/internal/handler/core/getcomputilitystatisticshandler.go b/api/internal/handler/core/getcomputilitystatisticshandler.go index 51d91b8e..8a03ba36 100644 --- a/api/internal/handler/core/getcomputilitystatisticshandler.go +++ b/api/internal/handler/core/getcomputilitystatisticshandler.go @@ -1,17 +1,3 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( diff --git a/api/internal/handler/core/getcomputingpowerhandler.go b/api/internal/handler/core/getcomputingpowerhandler.go index 09ea3475..9e4c77ed 100644 --- a/api/internal/handler/core/getcomputingpowerhandler.go +++ b/api/internal/handler/core/getcomputingpowerhandler.go @@ -1,17 +1,3 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( diff --git a/api/internal/handler/core/getgeneralinfohandler.go b/api/internal/handler/core/getgeneralinfohandler.go index 87febd89..de4dc89f 100644 --- a/api/internal/handler/core/getgeneralinfohandler.go +++ b/api/internal/handler/core/getgeneralinfohandler.go @@ -1,17 +1,3 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( diff --git a/api/internal/handler/core/getregionhandler.go b/api/internal/handler/core/getregionhandler.go index 5e639d9f..f85e16c7 100644 --- a/api/internal/handler/core/getregionhandler.go +++ b/api/internal/handler/core/getregionhandler.go @@ -1,17 +1,3 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( diff --git a/api/internal/handler/core/getresourcepanelconfighandler.go b/api/internal/handler/core/getresourcepanelconfighandler.go index 36942c2f..45dde0c1 100644 --- a/api/internal/handler/core/getresourcepanelconfighandler.go +++ b/api/internal/handler/core/getresourcepanelconfighandler.go @@ -1,24 +1,9 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( "net/http" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" ) @@ -27,6 +12,10 @@ func GetResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc return func(w http.ResponseWriter, r *http.Request) { l := core.NewGetResourcePanelConfigLogic(r.Context(), svcCtx) resp, err := l.GetResourcePanelConfig() - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/core/jobtotalhandler.go b/api/internal/handler/core/jobtotalhandler.go index 8e31d97b..91caa200 100644 --- a/api/internal/handler/core/jobtotalhandler.go +++ b/api/internal/handler/core/jobtotalhandler.go @@ -1,23 +1,9 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" ) @@ -26,6 +12,10 @@ func JobTotalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := core.NewJobTotalLogic(r.Context(), svcCtx) resp, err := l.JobTotal() - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/core/listcenterhandler.go b/api/internal/handler/core/listcenterhandler.go index c9697a8b..cf988c03 100644 --- a/api/internal/handler/core/listcenterhandler.go +++ b/api/internal/handler/core/listcenterhandler.go @@ -1,17 +1,3 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( diff --git a/api/internal/handler/core/listclusterhandler.go b/api/internal/handler/core/listclusterhandler.go index a4a923ab..a2077a06 100644 --- a/api/internal/handler/core/listclusterhandler.go +++ b/api/internal/handler/core/listclusterhandler.go @@ -1,17 +1,3 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( diff --git a/api/internal/handler/core/listdomainresourcehandler.go b/api/internal/handler/core/listdomainresourcehandler.go index 1a7f819a..911beacf 100644 --- a/api/internal/handler/core/listdomainresourcehandler.go +++ b/api/internal/handler/core/listdomainresourcehandler.go @@ -1,24 +1,9 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( "net/http" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" ) @@ -27,6 +12,10 @@ func ListDomainResourceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := core.NewListDomainResourceLogic(r.Context(), svcCtx) resp, err := l.ListDomainResource() - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/core/listregionhandler.go b/api/internal/handler/core/listregionhandler.go index cfb1b1ab..c05760a6 100644 --- a/api/internal/handler/core/listregionhandler.go +++ b/api/internal/handler/core/listregionhandler.go @@ -1,17 +1,3 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( diff --git a/api/internal/handler/core/metricshandler.go b/api/internal/handler/core/metricshandler.go index fb157525..5f715b1d 100644 --- a/api/internal/handler/core/metricshandler.go +++ b/api/internal/handler/core/metricshandler.go @@ -1,12 +1,21 @@ package core import ( - "github.com/prometheus/client_golang/prometheus/promhttp" "net/http" + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" ) func MetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return promhttp.Handler().ServeHTTP + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewMetricsLogic(r.Context(), svcCtx) + err := l.Metrics() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } } diff --git a/api/internal/handler/core/nodeassetshandler.go b/api/internal/handler/core/nodeassetshandler.go index 21b4afde..f8bd04a4 100644 --- a/api/internal/handler/core/nodeassetshandler.go +++ b/api/internal/handler/core/nodeassetshandler.go @@ -1,23 +1,9 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" ) @@ -26,6 +12,10 @@ func NodeAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := core.NewNodeAssetsLogic(r.Context(), svcCtx) resp, err := l.NodeAssets() - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/core/participantlisthandler.go b/api/internal/handler/core/participantlisthandler.go index 2a306381..1f122e0f 100644 --- a/api/internal/handler/core/participantlisthandler.go +++ b/api/internal/handler/core/participantlisthandler.go @@ -1,23 +1,9 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" ) @@ -26,6 +12,10 @@ func ParticipantListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := core.NewParticipantListLogic(r.Context(), svcCtx) resp, err := l.ParticipantList() - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/core/pulltaskinfohandler.go b/api/internal/handler/core/pulltaskinfohandler.go index e1777968..87e8cccc 100644 --- a/api/internal/handler/core/pulltaskinfohandler.go +++ b/api/internal/handler/core/pulltaskinfohandler.go @@ -1,17 +1,17 @@ package core import ( - clientCore "gitlink.org.cn/JointCloud/pcm-coordinator/api/client" "net/http" "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" ) func PullTaskInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - var req clientCore.PullTaskInfoReq + var req types.PullTaskInfoReq if err := httpx.Parse(r, &req); err != nil { httpx.ErrorCtx(r.Context(), w, err) return diff --git a/api/internal/handler/core/pushtaskinfohandler.go b/api/internal/handler/core/pushtaskinfohandler.go index fa7f5e91..68c4637d 100644 --- a/api/internal/handler/core/pushtaskinfohandler.go +++ b/api/internal/handler/core/pushtaskinfohandler.go @@ -1,17 +1,17 @@ package core import ( - clientCore "gitlink.org.cn/JointCloud/pcm-coordinator/api/client" "net/http" "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" ) func PushTaskInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - var req clientCore.PushTaskInfoReq + var req types.PushTaskInfoReq if err := httpx.Parse(r, &req); err != nil { httpx.ErrorCtx(r.Context(), w, err) return diff --git a/api/internal/handler/core/putresourcepanelconfighandler.go b/api/internal/handler/core/putresourcepanelconfighandler.go index 8b45e55a..a425f19a 100644 --- a/api/internal/handler/core/putresourcepanelconfighandler.go +++ b/api/internal/handler/core/putresourcepanelconfighandler.go @@ -1,24 +1,8 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( "net/http" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" @@ -29,12 +13,16 @@ func PutResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc return func(w http.ResponseWriter, r *http.Request) { var req types.ResourcePanelConfigReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := core.NewPutResourcePanelConfigLogic(r.Context(), svcCtx) err := l.PutResourcePanelConfig(&req) - result.HttpResult(r, w, nil, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } } } diff --git a/api/internal/handler/core/scheduletaskbyyamlhandler.go b/api/internal/handler/core/scheduletaskbyyamlhandler.go index e597ad66..1841a389 100644 --- a/api/internal/handler/core/scheduletaskbyyamlhandler.go +++ b/api/internal/handler/core/scheduletaskbyyamlhandler.go @@ -1,22 +1,6 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils" "net/http" "github.com/zeromicro/go-zero/rest/httpx" @@ -29,22 +13,16 @@ func ScheduleTaskByYamlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ScheduleTaskByYamlReq if err := httpx.Parse(r, &req); err != nil { - result.HttpResult(r, w, nil, err) - return - } - // 解析yaml文件 - _, fileHeader, err := r.FormFile("file") - if err != nil { - result.HttpResult(r, w, nil, err) - return - } - err = utils.Yaml2struct(fileHeader, &req) - if err != nil { - result.HttpResult(r, w, nil, err) + httpx.ErrorCtx(r.Context(), w, err) return } + l := core.NewScheduleTaskByYamlLogic(r.Context(), svcCtx) - resp, err := l.ScheduleTaskByYaml(&req) - result.HttpResult(r, w, resp, err) + err := l.ScheduleTaskByYaml(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } } } diff --git a/api/internal/handler/core/syncclusterloadhandler.go b/api/internal/handler/core/syncclusterloadhandler.go index cd8de3a3..ff36e15b 100644 --- a/api/internal/handler/core/syncclusterloadhandler.go +++ b/api/internal/handler/core/syncclusterloadhandler.go @@ -1,7 +1,6 @@ package core import ( - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" "net/http" "github.com/zeromicro/go-zero/rest/httpx" @@ -20,6 +19,10 @@ func SyncClusterLoadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { l := core.NewSyncClusterLoadLogic(r.Context(), svcCtx) err := l.SyncClusterLoad(&req) - result.HttpResult(r, w, nil, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } } } diff --git a/api/internal/handler/core/taskdetailhandler.go b/api/internal/handler/core/taskdetailhandler.go index f4325530..e97f2706 100644 --- a/api/internal/handler/core/taskdetailhandler.go +++ b/api/internal/handler/core/taskdetailhandler.go @@ -1,21 +1,6 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" "net/http" "github.com/zeromicro/go-zero/rest/httpx" @@ -34,6 +19,10 @@ func TaskDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { l := core.NewTaskDetailLogic(r.Context(), svcCtx) resp, err := l.TaskDetail(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/core/tasklisthandler.go b/api/internal/handler/core/tasklisthandler.go index 18a7ad80..7b239009 100644 --- a/api/internal/handler/core/tasklisthandler.go +++ b/api/internal/handler/core/tasklisthandler.go @@ -1,17 +1,3 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( diff --git a/api/internal/handler/dictionary/adddicthandler.go b/api/internal/handler/dictionary/adddicthandler.go index f97da1bb..9abc0f7a 100644 --- a/api/internal/handler/dictionary/adddicthandler.go +++ b/api/internal/handler/dictionary/adddicthandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func AddDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictEditReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewAddDictLogic(r.Context(), svcCtx) resp, err := l.AddDict(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/adddictitemhandler.go b/api/internal/handler/dictionary/adddictitemhandler.go index 44dbe883..c1ab2c69 100644 --- a/api/internal/handler/dictionary/adddictitemhandler.go +++ b/api/internal/handler/dictionary/adddictitemhandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func AddDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictItemEditReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewAddDictItemLogic(r.Context(), svcCtx) resp, err := l.AddDictItem(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/deletedicthandler.go b/api/internal/handler/dictionary/deletedicthandler.go index e65e54c2..435f529e 100644 --- a/api/internal/handler/dictionary/deletedicthandler.go +++ b/api/internal/handler/dictionary/deletedicthandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func DeleteDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CId if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewDeleteDictLogic(r.Context(), svcCtx) resp, err := l.DeleteDict(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/deletedictitemhandler.go b/api/internal/handler/dictionary/deletedictitemhandler.go index 65139c09..e029202f 100644 --- a/api/internal/handler/dictionary/deletedictitemhandler.go +++ b/api/internal/handler/dictionary/deletedictitemhandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func DeleteDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CId if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewDeleteDictItemLogic(r.Context(), svcCtx) resp, err := l.DeleteDictItem(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/editdicthandler.go b/api/internal/handler/dictionary/editdicthandler.go index fe0ef391..b63e41be 100644 --- a/api/internal/handler/dictionary/editdicthandler.go +++ b/api/internal/handler/dictionary/editdicthandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func EditDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictEditReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewEditDictLogic(r.Context(), svcCtx) resp, err := l.EditDict(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/editdictitemhandler.go b/api/internal/handler/dictionary/editdictitemhandler.go index 295e9095..f4f2fd6c 100644 --- a/api/internal/handler/dictionary/editdictitemhandler.go +++ b/api/internal/handler/dictionary/editdictitemhandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func EditDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictItemEditReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewEditDictItemLogic(r.Context(), svcCtx) resp, err := l.EditDictItem(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/getdicthandler.go b/api/internal/handler/dictionary/getdicthandler.go index b1b56d0d..4a958990 100644 --- a/api/internal/handler/dictionary/getdicthandler.go +++ b/api/internal/handler/dictionary/getdicthandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func GetDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CId if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewGetDictLogic(r.Context(), svcCtx) resp, err := l.GetDict(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/getdictitemhandler.go b/api/internal/handler/dictionary/getdictitemhandler.go index bbfe113f..60d8ce06 100644 --- a/api/internal/handler/dictionary/getdictitemhandler.go +++ b/api/internal/handler/dictionary/getdictitemhandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func GetDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CId if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewGetDictItemLogic(r.Context(), svcCtx) resp, err := l.GetDictItem(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/listdicthandler.go b/api/internal/handler/dictionary/listdicthandler.go index 72dac7c8..5c34a136 100644 --- a/api/internal/handler/dictionary/listdicthandler.go +++ b/api/internal/handler/dictionary/listdicthandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func ListDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewListDictLogic(r.Context(), svcCtx) resp, err := l.ListDict(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/listdictitembycodehandler.go b/api/internal/handler/dictionary/listdictitembycodehandler.go index c6400185..98c6feab 100644 --- a/api/internal/handler/dictionary/listdictitembycodehandler.go +++ b/api/internal/handler/dictionary/listdictitembycodehandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func ListDictItemByCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictCodeReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewListDictItemByCodeLogic(r.Context(), svcCtx) resp, err := l.ListDictItemByCode(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/handler/dictionary/listdictitemhandler.go b/api/internal/handler/dictionary/listdictitemhandler.go index 16df182d..5607ee04 100644 --- a/api/internal/handler/dictionary/listdictitemhandler.go +++ b/api/internal/handler/dictionary/listdictitemhandler.go @@ -1,24 +1,28 @@ package dictionary import ( + "net/http" + "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "net/http" ) func ListDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictItemReq if err := httpx.Parse(r, &req); err != nil { - result.ParamErrorResult(r, w, err) + httpx.ErrorCtx(r.Context(), w, err) return } l := dictionary.NewListDictItemLogic(r.Context(), svcCtx) resp, err := l.ListDictItem(&req) - result.HttpResult(r, w, resp, err) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } } } diff --git a/api/internal/types/types.go b/api/internal/types/types.go index 074e9a0b..ccc11455 100644 --- a/api/internal/types/types.go +++ b/api/internal/types/types.go @@ -855,7 +855,6 @@ type CommitHpcTaskReq struct { TenantId int64 `json:"tenantId,optional"` TaskId int64 `json:"taskId,optional"` AdapterId int64 `json:"adapterId,optional"` - ClusterType string `json:"clusterType,optional"` MatchLabels map[string]string `json:"matchLabels,optional"` CardCount int64 `json:"cardCount,optional"` WorkDir string `json:"workDir,optional"` //paratera:workingDir @@ -873,9 +872,7 @@ type CommitHpcTaskReq struct { } type CommitHpcTaskResp struct { - Code int32 `json:"code"` - Msg string `json:"msg"` - TaskId int64 `json:"taskId"` + TaskId int64 `json:"taskId"` } type ListJobReq struct { @@ -2884,9 +2881,11 @@ type CreateServerResp struct { type Server struct { Name string `json:"name,optional" copier:"Name"` FlavorRef string `json:"flavorRef,optional" copier:"FlavorRef"` + Description string `json:"description,optional" copier:"Description"` ImageRef string `json:"imageRef,optional" copier:"ImageRef"` Networks []CreNetwork `json:"networks,optional" copier:"Networks"` BlockDeviceMappingV2 []Block_device_mapping_v2 `json:"block_device_mapping_v2,optional" copier:"BlockDeviceMappingV2"` + MinCount string `json:"min_count,optional" copier:"MinCount"` } type CreNetwork struct { @@ -3255,7 +3254,7 @@ type Network struct { Ipv6AddressScope string `json:"ipv6_address_scope,optional" copier:"Ipv6AddressScope"` L2Adjacency bool `json:"l2_adjacency,optional" copier:"L2Adjacency"` Mtu int64 `json:"mtu,optional" copier:"Mtu"` - Name string `json:",optional" copier:"Name"` + Name string `json:"name,optional" copier:"Name"` PortSecurityEnabled bool `json:"port_security_enabled,optional" copier:"PortSecurityEnabled"` ProjectId string `json:"project_id,optional" copier:"ProjectId"` QosPolicyId string `json:"qos_policy_id,optional" copier:"QosPolicyId"` @@ -5171,3 +5170,119 @@ type AiDatasetsResp struct { type AiStrategyResp struct { Strategies []string `json:"strategies"` } + +type PullTaskInfoReq struct { + AdapterId int64 `form:"adapterId"` +} + +type PullTaskInfoResp struct { + HpcInfoList []*HpcInfo `json:"HpcInfoList,omitempty"` + CloudInfoList []*CloudInfo `json:"CloudInfoList,omitempty"` + AiInfoList []*AiInfo `json:"AiInfoList,omitempty"` + VmInfoList []*VmInfo `json:"VmInfoList,omitempty"` +} + +type HpcInfo struct { + Id int64 `json:"id"` // id + TaskId int64 `json:"task_id"` // 任务id + JobId string `json:"job_id"` // 作业id(在第三方系统中的作业id) + ClusterId int64 `json:"cluster_id"` // 执行任务的集群id + ClusterType string `json:"cluster_type"` // 执行任务的集群类型 + Name string `json:"name"` // 名称 + Status string `json:"status"` // 状态 + CmdScript string `json:"cmd_script"` + StartTime string `json:"start_time"` // 开始时间 + RunningTime int64 `json:"running_time"` // 运行时间 + DerivedEs string `json:"derived_es"` + Cluster string `json:"cluster"` + BlockId int64 `json:"block_id"` + AllocNodes int64 `json:"alloc_nodes"` + AllocCpu int64 `json:"alloc_cpu"` + CardCount int64 `json:"card_count"` // 卡数 + Version string `json:"version"` + Account string `json:"account"` + WorkDir string `json:"work_dir"` // 工作路径 + AssocId int64 `json:"assoc_id"` + ExitCode int64 `json:"exit_code"` + WallTime string `json:"wall_time"` // 最大运行时间 + Result string `json:"result"` // 运行结果 + DeletedAt string `json:"deleted_at"` // 删除时间 + YamlString string `json:"yaml_string"` + AppType string `json:"app_type"` // 应用类型 + AppName string `json:"app_name"` // 应用名称 + Queue string `json:"queue"` // 队列名称 + SubmitType string `json:"submit_type"` // cmd(命令行模式) + NNode string `json:"n_node"` // 节点个数(当指定该参数时,GAP_NODE_STRING必须为"") + StdOutFile string `json:"std_out_file"` // 工作路径/std.err.%j + StdErrFile string `json:"std_err_file"` // 工作路径/std.err.%j + StdInput string `json:"std_input"` + Environment string `json:"environment"` + DeletedFlag int64 `json:"deleted_flag"` // 是否删除(0-否,1-是) + CreatedBy int64 `json:"created_by"` // 创建人 + CreatedTime string `json:"created_time"` // 创建时间 + UpdatedBy int64 `json:"updated_by"` // 更新人 + UpdatedTime string `json:"updated_time"` // 更新时间 +} + +type CloudInfo struct { + Participant int64 `json:"participant,omitempty"` + Id int64 `json:"id,omitempty"` + TaskId int64 `json:"taskId,omitempty"` + ApiVersion string `json:"apiVersion,omitempty"` + Kind string `json:"kind,omitempty"` + Namespace string `json:"namespace,omitempty"` + Name string `json:"name,omitempty"` + Status string `json:"status,omitempty"` + StartTime string `json:"startTime,omitempty"` + RunningTime int64 `json:"runningTime,omitempty"` + Result string `json:"result,omitempty"` + YamlString string `json:"yamlString,omitempty"` +} + +type AiInfo struct { + ParticipantId int64 `json:"participantId,omitempty"` + TaskId int64 `json:"taskId,omitempty"` + ProjectId string `json:"project_id,omitempty"` + Name string `json:"name,omitempty"` + Status string `json:"status,omitempty"` + StartTime string `json:"startTime,omitempty"` + RunningTime int64 `json:"runningTime,omitempty"` + Result string `json:"result,omitempty"` + JobId string `json:"jobId,omitempty"` + CreateTime string `json:"createTime,omitempty"` + ImageUrl string `json:"imageUrl,omitempty"` + Command string `json:"command,omitempty"` + FlavorId string `json:"flavorId,omitempty"` + SubscriptionId string `json:"subscriptionId,omitempty"` + ItemVersionId string `json:"itemVersionId,omitempty"` +} + +type VmInfo struct { + ParticipantId int64 `json:"participantId,omitempty"` + TaskId int64 `json:"taskId,omitempty"` + Name string `json:"name,omitempty"` + FlavorRef string `json:"flavor_ref,omitempty"` + ImageRef string `json:"image_ref,omitempty"` + NetworkUuid string `json:"network_uuid,omitempty"` + BlockUuid string `json:"block_uuid,omitempty"` + SourceType string `json:"source_type,omitempty"` + DeleteOnTermination bool `json:"delete_on_termination,omitempty"` + State string `json:"state,omitempty"` +} + +type PushTaskInfoReq struct { + AdapterId int64 `json:"adapterId"` + HpcInfoList []*HpcInfo `json:"hpcInfoList"` + CloudInfoList []*CloudInfo `json:"cloudInfoList"` + AiInfoList []*AiInfo `json:"aiInfoList"` + VmInfoList []*VmInfo `json:"vmInfoList"` +} + +type PushTaskInfoResp struct { + Code int64 `json:"code"` + Msg string `json:"msg"` +} + +type PushResourceInfoReq struct { + AdapterId int64 `json:"adapterId"` +} From f3277b72d8a1533041656042385e1f85c9c4a90d Mon Sep 17 00:00:00 2001 From: qiwang <1364512070@qq.com> Date: Mon, 25 Mar 2024 19:37:55 +0800 Subject: [PATCH 10/15] fix:Modify configuration file fields Former-commit-id: 3fa5bd31a09c993bc89ccafcc7850fd5f477f06a --- api/desc/core/pcm-core.api | 1 - api/desc/hpc/pcm-hpc.api | 3 + .../handler/adapters/adapterslisthandler.go | 28 - .../handler/adapters/clusterlisthandler.go | 28 - .../handler/adapters/createadapterhandler.go | 28 - .../handler/adapters/createclusterhandler.go | 28 - .../handler/adapters/deleteadapterhandler.go | 28 - .../handler/adapters/deleteclusterhandler.go | 28 - .../handler/adapters/getadapterhandler.go | 28 - .../adapters/getadapterrelationhandler.go | 28 - .../handler/adapters/getclusterhandler.go | 28 - .../handler/adapters/getclustersumhandler.go | 28 - .../handler/adapters/updateadapterhandler.go | 28 - .../handler/adapters/updateclusterhandler.go | 28 - .../handler/ai/createalgorithmhandler.go | 28 - .../handler/ai/createdatasethandler.go | 28 - .../handler/ai/createexporttaskhandler.go | 28 - .../handler/ai/createnotebookhandler.go | 28 - .../handler/ai/createprocessortaskhandler.go | 28 - .../handler/ai/createservicehandler.go | 28 - api/internal/handler/ai/createtaskhandler.go | 28 - .../handler/ai/createtrainingjobhandler.go | 28 - .../ai/createvisualizationjobhandler.go | 28 - .../handler/ai/deletealgorithmhandler.go | 28 - .../handler/ai/deletedatasethandler.go | 28 - .../handler/ai/deleteservicehandler.go | 28 - .../handler/ai/deletetrainingjobhandler.go | 28 - .../ai/getexporttasksofdatasethandler.go | 28 - .../ai/getexporttaskstatusofdatasethandler.go | 28 - .../handler/ai/getlisttrainingjobshandler.go | 28 - .../handler/ai/getnotebookstoragehandler.go | 28 - .../handler/ai/getvisualizationjobhandler.go | 28 - .../handler/ai/listalgorithmshandler.go | 28 - .../handler/ai/listclustershandler.go | 28 - api/internal/handler/ai/listdatasethandler.go | 28 - api/internal/handler/ai/listimporthandler.go | 28 - .../handler/ai/listnotebookhandler.go | 28 - .../handler/ai/listserviceshandler.go | 28 - .../handler/ai/mountnotebookstoragehandler.go | 28 - .../handler/ai/showalgorithmbyuuidhandler.go | 28 - api/internal/handler/ai/showservicehandler.go | 28 - .../handler/ai/startnotebookhandler.go | 28 - .../handler/ai/stopnotebookhandler.go | 28 - api/internal/handler/apps/appdetailhandler.go | 28 - api/internal/handler/apps/applisthandler.go | 28 - api/internal/handler/apps/apppodshandler.go | 28 - .../handler/apps/deleteappbyappnamehandler.go | 28 - .../handler/apps/getappbyappnamehandler.go | 28 - .../handler/apps/pauseappbyappnamehandler.go | 28 - .../apps/restartappbyappnamehandler.go | 28 - .../handler/apps/startappbyappnamehandler.go | 28 - .../handler/apps/updateappbyappnamehandler.go | 28 - .../handler/cloud/cloudlisthandler.go | 21 - .../handler/cloud/controllermetricshandler.go | 28 - .../handler/cloud/deleteclusterhandler.go | 28 - .../handler/cloud/deleteyamlhandler.go | 28 - .../handler/cloud/getclusterlisthandler.go | 28 - .../handler/cloud/noticetenanthandler.go | 21 - .../handler/cloud/registerclusterhandler.go | 28 - .../handler/cloud/updatetenanthandler.go | 28 - .../handler/core/centerresourceshandler.go | 21 - .../handler/core/committaskhandler.go | 28 - .../handler/core/commitvmtaskhandler.go | 28 - .../handler/core/deletetaskhandler.go | 28 - .../core/getcomputilitystatisticshandler.go | 21 - .../handler/core/getcomputingpowerhandler.go | 21 - .../handler/core/getgeneralinfohandler.go | 21 - api/internal/handler/core/getregionhandler.go | 21 - .../core/getresourcepanelconfighandler.go | 21 - api/internal/handler/core/jobtotalhandler.go | 21 - .../handler/core/listcenterhandler.go | 21 - .../handler/core/listclusterhandler.go | 28 - .../handler/core/listdomainresourcehandler.go | 21 - .../handler/core/listregionhandler.go | 21 - api/internal/handler/core/metricshandler.go | 21 - .../handler/core/nodeassetshandler.go | 21 - .../handler/core/participantlisthandler.go | 21 - .../handler/core/pulltaskinfohandler.go | 28 - .../handler/core/pushtaskinfohandler.go | 28 - .../core/putresourcepanelconfighandler.go | 28 - .../handler/core/scheduletaskbyyamlhandler.go | 28 - .../handler/core/syncclusterloadhandler.go | 28 - .../handler/core/taskdetailhandler.go | 28 - api/internal/handler/core/tasklisthandler.go | 28 - .../handler/dictionary/adddicthandler.go | 28 - .../handler/dictionary/adddictitemhandler.go | 28 - .../handler/dictionary/deletedicthandler.go | 28 - .../dictionary/deletedictitemhandler.go | 28 - .../handler/dictionary/editdicthandler.go | 28 - .../handler/dictionary/editdictitemhandler.go | 28 - .../handler/dictionary/getdicthandler.go | 28 - .../handler/dictionary/getdictitemhandler.go | 28 - .../handler/dictionary/listdicthandler.go | 28 - .../dictionary/listdictitembycodehandler.go | 28 - .../handler/dictionary/listdictitemhandler.go | 28 - .../handler/hpc/commithpctaskhandler.go | 28 - .../handler/hpc/listhistoryjobhandler.go | 28 - api/internal/handler/hpc/listjobhandler.go | 28 - .../handler/hpc/queueassetshandler.go | 21 - api/internal/handler/image/chunkhandler.go | 21 - .../handler/image/datasetcheckhandler.go | 28 - .../handler/image/imagelisthandler.go | 21 - .../handler/image/uploaddatasethandler.go | 21 - api/internal/handler/image/uploadhandler.go | 21 - api/internal/handler/routes.go | 1166 ----------------- .../schedulegetairesourcetypeshandler.go | 21 - .../schedule/schedulegetaitasktypeshandler.go | 21 - .../schedule/schedulegetdatasetshandler.go | 21 - .../schedule/schedulegetstrategyhandler.go | 21 - .../handler/schedule/schedulesubmithandler.go | 28 - .../storage/dailypowerscreenhandler.go | 28 - .../storage/percentercomputerpowershandler.go | 28 - .../handler/storage/screenstoragehandler.go | 28 - .../storelink/deletelinkimagehandler.go | 28 - .../storelink/deletelinktaskhandler.go | 28 - .../handler/storelink/getaispecshandler.go | 28 - .../storelink/getlinkimagelisthandler.go | 28 - .../handler/storelink/getlinktaskhandler.go | 28 - .../storelink/getparticipantshandler.go | 28 - .../storelink/submitlinktaskhandler.go | 28 - .../storelink/uploadlinkimagehandler.go | 28 - .../vm/addsecuritygrouptoserverhandler.go | 28 - .../handler/vm/bulkcreatenetworkshandler.go | 28 - .../vm/changeadministrativepasswordhandler.go | 28 - .../handler/vm/createfirewallgrouphandler.go | 28 - .../handler/vm/createfirewallpolicyhandler.go | 28 - .../handler/vm/createfirewallrulehandler.go | 28 - .../handler/vm/createflavorhandler.go | 28 - .../handler/vm/createfloatingiphandler.go | 28 - api/internal/handler/vm/createimagehandler.go | 28 - .../handler/vm/createnetworkhandler.go | 28 - .../vm/createnetworksegmentrangehandler.go | 28 - api/internal/handler/vm/createnodehandler.go | 28 - api/internal/handler/vm/createporthandler.go | 28 - .../handler/vm/createrouterhandler.go | 28 - .../handler/vm/createsecuritygrouphandler.go | 28 - .../vm/createsecuritygrouprulehandler.go | 28 - .../handler/vm/createserverhandler.go | 28 - .../handler/vm/createsubnethandler.go | 28 - .../handler/vm/createvolumehandler.go | 28 - .../handler/vm/createvolumetypeshandler.go | 28 - .../handler/vm/deletefirewallgrouphandler.go | 28 - .../handler/vm/deletefirewallpolicyhandler.go | 28 - .../handler/vm/deletefirewallrulehandler.go | 28 - .../handler/vm/deleteflavorhandler.go | 28 - .../handler/vm/deletefloatingiphandler.go | 28 - api/internal/handler/vm/deleteimagehandler.go | 28 - .../handler/vm/deletenetworkhandler.go | 28 - .../vm/deletenetworksegmentrangeshandler.go | 28 - api/internal/handler/vm/deletenodehandler.go | 28 - api/internal/handler/vm/deleteporthandler.go | 28 - .../handler/vm/deleterouterhandler.go | 28 - .../handler/vm/deletesecuritygrouphandler.go | 28 - .../vm/deletesecuritygrouprulehandler.go | 28 - .../handler/vm/deleteserverhandler.go | 28 - .../handler/vm/deletesubnethandler.go | 28 - .../handler/vm/deletevolumehandler.go | 28 - .../handler/vm/deletevolumetypehandler.go | 28 - .../handler/vm/getcomputelimitshandler.go | 28 - api/internal/handler/vm/getimagenumhandler.go | 28 - .../handler/vm/getnetworknumhandler.go | 28 - .../vm/getserversdetailedbyidhandler.go | 28 - .../vm/getvolumedetailedbyidhandler.go | 28 - .../handler/vm/getvolumelimitshandler.go | 28 - .../handler/vm/listfirewallgroupshandler.go | 28 - .../handler/vm/listfirewallpolicieshandler.go | 28 - .../handler/vm/listfirewallruleshandler.go | 28 - .../handler/vm/listflavorsdetailhandler.go | 28 - .../handler/vm/listfloatingipshandler.go | 28 - api/internal/handler/vm/listimageshandler.go | 28 - .../listnetworksegmentrangesrangehandler.go | 28 - .../handler/vm/listnetworkshandler.go | 28 - api/internal/handler/vm/listnodeshandler.go | 28 - api/internal/handler/vm/listportshandler.go | 28 - api/internal/handler/vm/listroutershandler.go | 28 - .../vm/listsecuritygroupruleshandler.go | 28 - .../handler/vm/listsecuritygroupshandler.go | 28 - api/internal/handler/vm/listserverhandler.go | 28 - .../handler/vm/listserversdetailedhandler.go | 28 - api/internal/handler/vm/listsubnetshandler.go | 28 - .../handler/vm/listvolumesdetailhandler.go | 28 - api/internal/handler/vm/listvolumeshandler.go | 28 - .../handler/vm/listvolumetypeshandler.go | 28 - .../handler/vm/migrateserverhandler.go | 28 - api/internal/handler/vm/pauseserverhandler.go | 28 - .../handler/vm/rebootserverhandler.go | 28 - .../handler/vm/removesecuritygrouphandler.go | 28 - .../handler/vm/rescueserverhandler.go | 28 - .../handler/vm/resizeserverhandler.go | 28 - .../handler/vm/shelveserverhandler.go | 28 - .../vm/showfirewallgroupdetailshandler.go | 28 - .../vm/showfirewallpolicydetailshandler.go | 28 - .../vm/showfirewallruledetailshandler.go | 28 - .../vm/showfloatingipdetailshandler.go | 28 - .../handler/vm/shownetworkdetailshandler.go | 28 - .../shownetworksegmentrangedetailshandler.go | 28 - .../handler/vm/shownodedetailshandler.go | 28 - .../handler/vm/showportdetailshandler.go | 28 - .../handler/vm/showrouterdetailshandler.go | 28 - .../handler/vm/showsecuritygrouphandler.go | 28 - .../vm/showsecuritygrouprulehandler.go | 28 - api/internal/handler/vm/startserverhandler.go | 28 - api/internal/handler/vm/stopserverhandler.go | 28 - .../handler/vm/suspendserverhandler.go | 28 - .../handler/vm/unpauseserverhandler.go | 28 - api/internal/handler/vm/unrescuehandler.go | 28 - .../handler/vm/updatefirewallgrouphandler.go | 28 - .../handler/vm/updatefloatingiphandler.go | 28 - .../handler/vm/updatenetworkhandler.go | 28 - .../vm/updatenetworksegmentrangeshandler.go | 28 - api/internal/handler/vm/updateporthandler.go | 28 - .../handler/vm/updaterouterhandler.go | 28 - .../handler/vm/updatesecuritygrouphandler.go | 28 - .../handler/vm/updateserverhandler.go | 28 - .../handler/vm/updatesubnethandler.go | 28 - .../handler/vm/updatevolumehandler.go | 28 - api/internal/handler/vm/uploadimagehandler.go | 28 - api/internal/types/types.go | 7 +- 218 files changed, 8 insertions(+), 6993 deletions(-) delete mode 100644 api/internal/handler/adapters/adapterslisthandler.go delete mode 100644 api/internal/handler/adapters/clusterlisthandler.go delete mode 100644 api/internal/handler/adapters/createadapterhandler.go delete mode 100644 api/internal/handler/adapters/createclusterhandler.go delete mode 100644 api/internal/handler/adapters/deleteadapterhandler.go delete mode 100644 api/internal/handler/adapters/deleteclusterhandler.go delete mode 100644 api/internal/handler/adapters/getadapterhandler.go delete mode 100644 api/internal/handler/adapters/getadapterrelationhandler.go delete mode 100644 api/internal/handler/adapters/getclusterhandler.go delete mode 100644 api/internal/handler/adapters/getclustersumhandler.go delete mode 100644 api/internal/handler/adapters/updateadapterhandler.go delete mode 100644 api/internal/handler/adapters/updateclusterhandler.go delete mode 100644 api/internal/handler/ai/createalgorithmhandler.go delete mode 100644 api/internal/handler/ai/createdatasethandler.go delete mode 100644 api/internal/handler/ai/createexporttaskhandler.go delete mode 100644 api/internal/handler/ai/createnotebookhandler.go delete mode 100644 api/internal/handler/ai/createprocessortaskhandler.go delete mode 100644 api/internal/handler/ai/createservicehandler.go delete mode 100644 api/internal/handler/ai/createtaskhandler.go delete mode 100644 api/internal/handler/ai/createtrainingjobhandler.go delete mode 100644 api/internal/handler/ai/createvisualizationjobhandler.go delete mode 100644 api/internal/handler/ai/deletealgorithmhandler.go delete mode 100644 api/internal/handler/ai/deletedatasethandler.go delete mode 100644 api/internal/handler/ai/deleteservicehandler.go delete mode 100644 api/internal/handler/ai/deletetrainingjobhandler.go delete mode 100644 api/internal/handler/ai/getexporttasksofdatasethandler.go delete mode 100644 api/internal/handler/ai/getexporttaskstatusofdatasethandler.go delete mode 100644 api/internal/handler/ai/getlisttrainingjobshandler.go delete mode 100644 api/internal/handler/ai/getnotebookstoragehandler.go delete mode 100644 api/internal/handler/ai/getvisualizationjobhandler.go delete mode 100644 api/internal/handler/ai/listalgorithmshandler.go delete mode 100644 api/internal/handler/ai/listclustershandler.go delete mode 100644 api/internal/handler/ai/listdatasethandler.go delete mode 100644 api/internal/handler/ai/listimporthandler.go delete mode 100644 api/internal/handler/ai/listnotebookhandler.go delete mode 100644 api/internal/handler/ai/listserviceshandler.go delete mode 100644 api/internal/handler/ai/mountnotebookstoragehandler.go delete mode 100644 api/internal/handler/ai/showalgorithmbyuuidhandler.go delete mode 100644 api/internal/handler/ai/showservicehandler.go delete mode 100644 api/internal/handler/ai/startnotebookhandler.go delete mode 100644 api/internal/handler/ai/stopnotebookhandler.go delete mode 100644 api/internal/handler/apps/appdetailhandler.go delete mode 100644 api/internal/handler/apps/applisthandler.go delete mode 100644 api/internal/handler/apps/apppodshandler.go delete mode 100644 api/internal/handler/apps/deleteappbyappnamehandler.go delete mode 100644 api/internal/handler/apps/getappbyappnamehandler.go delete mode 100644 api/internal/handler/apps/pauseappbyappnamehandler.go delete mode 100644 api/internal/handler/apps/restartappbyappnamehandler.go delete mode 100644 api/internal/handler/apps/startappbyappnamehandler.go delete mode 100644 api/internal/handler/apps/updateappbyappnamehandler.go delete mode 100644 api/internal/handler/cloud/cloudlisthandler.go delete mode 100644 api/internal/handler/cloud/controllermetricshandler.go delete mode 100644 api/internal/handler/cloud/deleteclusterhandler.go delete mode 100644 api/internal/handler/cloud/deleteyamlhandler.go delete mode 100644 api/internal/handler/cloud/getclusterlisthandler.go delete mode 100644 api/internal/handler/cloud/noticetenanthandler.go delete mode 100644 api/internal/handler/cloud/registerclusterhandler.go delete mode 100644 api/internal/handler/cloud/updatetenanthandler.go delete mode 100644 api/internal/handler/core/centerresourceshandler.go delete mode 100644 api/internal/handler/core/committaskhandler.go delete mode 100644 api/internal/handler/core/commitvmtaskhandler.go delete mode 100644 api/internal/handler/core/deletetaskhandler.go delete mode 100644 api/internal/handler/core/getcomputilitystatisticshandler.go delete mode 100644 api/internal/handler/core/getcomputingpowerhandler.go delete mode 100644 api/internal/handler/core/getgeneralinfohandler.go delete mode 100644 api/internal/handler/core/getregionhandler.go delete mode 100644 api/internal/handler/core/getresourcepanelconfighandler.go delete mode 100644 api/internal/handler/core/jobtotalhandler.go delete mode 100644 api/internal/handler/core/listcenterhandler.go delete mode 100644 api/internal/handler/core/listclusterhandler.go delete mode 100644 api/internal/handler/core/listdomainresourcehandler.go delete mode 100644 api/internal/handler/core/listregionhandler.go delete mode 100644 api/internal/handler/core/metricshandler.go delete mode 100644 api/internal/handler/core/nodeassetshandler.go delete mode 100644 api/internal/handler/core/participantlisthandler.go delete mode 100644 api/internal/handler/core/pulltaskinfohandler.go delete mode 100644 api/internal/handler/core/pushtaskinfohandler.go delete mode 100644 api/internal/handler/core/putresourcepanelconfighandler.go delete mode 100644 api/internal/handler/core/scheduletaskbyyamlhandler.go delete mode 100644 api/internal/handler/core/syncclusterloadhandler.go delete mode 100644 api/internal/handler/core/taskdetailhandler.go delete mode 100644 api/internal/handler/core/tasklisthandler.go delete mode 100644 api/internal/handler/dictionary/adddicthandler.go delete mode 100644 api/internal/handler/dictionary/adddictitemhandler.go delete mode 100644 api/internal/handler/dictionary/deletedicthandler.go delete mode 100644 api/internal/handler/dictionary/deletedictitemhandler.go delete mode 100644 api/internal/handler/dictionary/editdicthandler.go delete mode 100644 api/internal/handler/dictionary/editdictitemhandler.go delete mode 100644 api/internal/handler/dictionary/getdicthandler.go delete mode 100644 api/internal/handler/dictionary/getdictitemhandler.go delete mode 100644 api/internal/handler/dictionary/listdicthandler.go delete mode 100644 api/internal/handler/dictionary/listdictitembycodehandler.go delete mode 100644 api/internal/handler/dictionary/listdictitemhandler.go delete mode 100644 api/internal/handler/hpc/commithpctaskhandler.go delete mode 100644 api/internal/handler/hpc/listhistoryjobhandler.go delete mode 100644 api/internal/handler/hpc/listjobhandler.go delete mode 100644 api/internal/handler/hpc/queueassetshandler.go delete mode 100644 api/internal/handler/image/chunkhandler.go delete mode 100644 api/internal/handler/image/datasetcheckhandler.go delete mode 100644 api/internal/handler/image/imagelisthandler.go delete mode 100644 api/internal/handler/image/uploaddatasethandler.go delete mode 100644 api/internal/handler/image/uploadhandler.go delete mode 100644 api/internal/handler/routes.go delete mode 100644 api/internal/handler/schedule/schedulegetairesourcetypeshandler.go delete mode 100644 api/internal/handler/schedule/schedulegetaitasktypeshandler.go delete mode 100644 api/internal/handler/schedule/schedulegetdatasetshandler.go delete mode 100644 api/internal/handler/schedule/schedulegetstrategyhandler.go delete mode 100644 api/internal/handler/schedule/schedulesubmithandler.go delete mode 100644 api/internal/handler/storage/dailypowerscreenhandler.go delete mode 100644 api/internal/handler/storage/percentercomputerpowershandler.go delete mode 100644 api/internal/handler/storage/screenstoragehandler.go delete mode 100644 api/internal/handler/storelink/deletelinkimagehandler.go delete mode 100644 api/internal/handler/storelink/deletelinktaskhandler.go delete mode 100644 api/internal/handler/storelink/getaispecshandler.go delete mode 100644 api/internal/handler/storelink/getlinkimagelisthandler.go delete mode 100644 api/internal/handler/storelink/getlinktaskhandler.go delete mode 100644 api/internal/handler/storelink/getparticipantshandler.go delete mode 100644 api/internal/handler/storelink/submitlinktaskhandler.go delete mode 100644 api/internal/handler/storelink/uploadlinkimagehandler.go delete mode 100644 api/internal/handler/vm/addsecuritygrouptoserverhandler.go delete mode 100644 api/internal/handler/vm/bulkcreatenetworkshandler.go delete mode 100644 api/internal/handler/vm/changeadministrativepasswordhandler.go delete mode 100644 api/internal/handler/vm/createfirewallgrouphandler.go delete mode 100644 api/internal/handler/vm/createfirewallpolicyhandler.go delete mode 100644 api/internal/handler/vm/createfirewallrulehandler.go delete mode 100644 api/internal/handler/vm/createflavorhandler.go delete mode 100644 api/internal/handler/vm/createfloatingiphandler.go delete mode 100644 api/internal/handler/vm/createimagehandler.go delete mode 100644 api/internal/handler/vm/createnetworkhandler.go delete mode 100644 api/internal/handler/vm/createnetworksegmentrangehandler.go delete mode 100644 api/internal/handler/vm/createnodehandler.go delete mode 100644 api/internal/handler/vm/createporthandler.go delete mode 100644 api/internal/handler/vm/createrouterhandler.go delete mode 100644 api/internal/handler/vm/createsecuritygrouphandler.go delete mode 100644 api/internal/handler/vm/createsecuritygrouprulehandler.go delete mode 100644 api/internal/handler/vm/createserverhandler.go delete mode 100644 api/internal/handler/vm/createsubnethandler.go delete mode 100644 api/internal/handler/vm/createvolumehandler.go delete mode 100644 api/internal/handler/vm/createvolumetypeshandler.go delete mode 100644 api/internal/handler/vm/deletefirewallgrouphandler.go delete mode 100644 api/internal/handler/vm/deletefirewallpolicyhandler.go delete mode 100644 api/internal/handler/vm/deletefirewallrulehandler.go delete mode 100644 api/internal/handler/vm/deleteflavorhandler.go delete mode 100644 api/internal/handler/vm/deletefloatingiphandler.go delete mode 100644 api/internal/handler/vm/deleteimagehandler.go delete mode 100644 api/internal/handler/vm/deletenetworkhandler.go delete mode 100644 api/internal/handler/vm/deletenetworksegmentrangeshandler.go delete mode 100644 api/internal/handler/vm/deletenodehandler.go delete mode 100644 api/internal/handler/vm/deleteporthandler.go delete mode 100644 api/internal/handler/vm/deleterouterhandler.go delete mode 100644 api/internal/handler/vm/deletesecuritygrouphandler.go delete mode 100644 api/internal/handler/vm/deletesecuritygrouprulehandler.go delete mode 100644 api/internal/handler/vm/deleteserverhandler.go delete mode 100644 api/internal/handler/vm/deletesubnethandler.go delete mode 100644 api/internal/handler/vm/deletevolumehandler.go delete mode 100644 api/internal/handler/vm/deletevolumetypehandler.go delete mode 100644 api/internal/handler/vm/getcomputelimitshandler.go delete mode 100644 api/internal/handler/vm/getimagenumhandler.go delete mode 100644 api/internal/handler/vm/getnetworknumhandler.go delete mode 100644 api/internal/handler/vm/getserversdetailedbyidhandler.go delete mode 100644 api/internal/handler/vm/getvolumedetailedbyidhandler.go delete mode 100644 api/internal/handler/vm/getvolumelimitshandler.go delete mode 100644 api/internal/handler/vm/listfirewallgroupshandler.go delete mode 100644 api/internal/handler/vm/listfirewallpolicieshandler.go delete mode 100644 api/internal/handler/vm/listfirewallruleshandler.go delete mode 100644 api/internal/handler/vm/listflavorsdetailhandler.go delete mode 100644 api/internal/handler/vm/listfloatingipshandler.go delete mode 100644 api/internal/handler/vm/listimageshandler.go delete mode 100644 api/internal/handler/vm/listnetworksegmentrangesrangehandler.go delete mode 100644 api/internal/handler/vm/listnetworkshandler.go delete mode 100644 api/internal/handler/vm/listnodeshandler.go delete mode 100644 api/internal/handler/vm/listportshandler.go delete mode 100644 api/internal/handler/vm/listroutershandler.go delete mode 100644 api/internal/handler/vm/listsecuritygroupruleshandler.go delete mode 100644 api/internal/handler/vm/listsecuritygroupshandler.go delete mode 100644 api/internal/handler/vm/listserverhandler.go delete mode 100644 api/internal/handler/vm/listserversdetailedhandler.go delete mode 100644 api/internal/handler/vm/listsubnetshandler.go delete mode 100644 api/internal/handler/vm/listvolumesdetailhandler.go delete mode 100644 api/internal/handler/vm/listvolumeshandler.go delete mode 100644 api/internal/handler/vm/listvolumetypeshandler.go delete mode 100644 api/internal/handler/vm/migrateserverhandler.go delete mode 100644 api/internal/handler/vm/pauseserverhandler.go delete mode 100644 api/internal/handler/vm/rebootserverhandler.go delete mode 100644 api/internal/handler/vm/removesecuritygrouphandler.go delete mode 100644 api/internal/handler/vm/rescueserverhandler.go delete mode 100644 api/internal/handler/vm/resizeserverhandler.go delete mode 100644 api/internal/handler/vm/shelveserverhandler.go delete mode 100644 api/internal/handler/vm/showfirewallgroupdetailshandler.go delete mode 100644 api/internal/handler/vm/showfirewallpolicydetailshandler.go delete mode 100644 api/internal/handler/vm/showfirewallruledetailshandler.go delete mode 100644 api/internal/handler/vm/showfloatingipdetailshandler.go delete mode 100644 api/internal/handler/vm/shownetworkdetailshandler.go delete mode 100644 api/internal/handler/vm/shownetworksegmentrangedetailshandler.go delete mode 100644 api/internal/handler/vm/shownodedetailshandler.go delete mode 100644 api/internal/handler/vm/showportdetailshandler.go delete mode 100644 api/internal/handler/vm/showrouterdetailshandler.go delete mode 100644 api/internal/handler/vm/showsecuritygrouphandler.go delete mode 100644 api/internal/handler/vm/showsecuritygrouprulehandler.go delete mode 100644 api/internal/handler/vm/startserverhandler.go delete mode 100644 api/internal/handler/vm/stopserverhandler.go delete mode 100644 api/internal/handler/vm/suspendserverhandler.go delete mode 100644 api/internal/handler/vm/unpauseserverhandler.go delete mode 100644 api/internal/handler/vm/unrescuehandler.go delete mode 100644 api/internal/handler/vm/updatefirewallgrouphandler.go delete mode 100644 api/internal/handler/vm/updatefloatingiphandler.go delete mode 100644 api/internal/handler/vm/updatenetworkhandler.go delete mode 100644 api/internal/handler/vm/updatenetworksegmentrangeshandler.go delete mode 100644 api/internal/handler/vm/updateporthandler.go delete mode 100644 api/internal/handler/vm/updaterouterhandler.go delete mode 100644 api/internal/handler/vm/updatesecuritygrouphandler.go delete mode 100644 api/internal/handler/vm/updateserverhandler.go delete mode 100644 api/internal/handler/vm/updatesubnethandler.go delete mode 100644 api/internal/handler/vm/updatevolumehandler.go delete mode 100644 api/internal/handler/vm/uploadimagehandler.go diff --git a/api/desc/core/pcm-core.api b/api/desc/core/pcm-core.api index a61f1a35..56751a8e 100644 --- a/api/desc/core/pcm-core.api +++ b/api/desc/core/pcm-core.api @@ -109,7 +109,6 @@ type ( ) type ( - commitVmTaskReq { Name string `json:"name"` NsID string `json:"nsID"` diff --git a/api/desc/hpc/pcm-hpc.api b/api/desc/hpc/pcm-hpc.api index 23bb516c..2a971c4d 100644 --- a/api/desc/hpc/pcm-hpc.api +++ b/api/desc/hpc/pcm-hpc.api @@ -38,12 +38,15 @@ type ( StdErrFile string `json:"stdErrFile,optional"` StdInput string `json:"stdInput,optional"` Environment map[string]string `json:"environment,optional"` + ClusterType string `json:"clusterType,optional"` } ) type ( commitHpcTaskResp { TaskId int64 `json:"taskId"` + Code int32 `json:"code"` + Msg string `json:"msg"` } ) diff --git a/api/internal/handler/adapters/adapterslisthandler.go b/api/internal/handler/adapters/adapterslisthandler.go deleted file mode 100644 index 3d84c0c8..00000000 --- a/api/internal/handler/adapters/adapterslisthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func AdaptersListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AdapterQueryReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewAdaptersListLogic(r.Context(), svcCtx) - resp, err := l.AdaptersList(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/clusterlisthandler.go b/api/internal/handler/adapters/clusterlisthandler.go deleted file mode 100644 index f1863304..00000000 --- a/api/internal/handler/adapters/clusterlisthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ClusterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ClusterReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewClusterListLogic(r.Context(), svcCtx) - resp, err := l.ClusterList(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/createadapterhandler.go b/api/internal/handler/adapters/createadapterhandler.go deleted file mode 100644 index 42b60968..00000000 --- a/api/internal/handler/adapters/createadapterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AdapterCreateReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewCreateAdapterLogic(r.Context(), svcCtx) - resp, err := l.CreateAdapter(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/createclusterhandler.go b/api/internal/handler/adapters/createclusterhandler.go deleted file mode 100644 index 80eaa0de..00000000 --- a/api/internal/handler/adapters/createclusterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ClusterCreateReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewCreateClusterLogic(r.Context(), svcCtx) - resp, err := l.CreateCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/deleteadapterhandler.go b/api/internal/handler/adapters/deleteadapterhandler.go deleted file mode 100644 index b2e1c7ca..00000000 --- a/api/internal/handler/adapters/deleteadapterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AdapterDelReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewDeleteAdapterLogic(r.Context(), svcCtx) - resp, err := l.DeleteAdapter(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/deleteclusterhandler.go b/api/internal/handler/adapters/deleteclusterhandler.go deleted file mode 100644 index 62e800f1..00000000 --- a/api/internal/handler/adapters/deleteclusterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.FId - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewDeleteClusterLogic(r.Context(), svcCtx) - resp, err := l.DeleteCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/getadapterhandler.go b/api/internal/handler/adapters/getadapterhandler.go deleted file mode 100644 index 2e4e189d..00000000 --- a/api/internal/handler/adapters/getadapterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AdapterDelReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewGetAdapterLogic(r.Context(), svcCtx) - resp, err := l.GetAdapter(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/getadapterrelationhandler.go b/api/internal/handler/adapters/getadapterrelationhandler.go deleted file mode 100644 index 13212c35..00000000 --- a/api/internal/handler/adapters/getadapterrelationhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetAdapterRelationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AdapterRelationQueryReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewGetAdapterRelationLogic(r.Context(), svcCtx) - resp, err := l.GetAdapterRelation(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/getclusterhandler.go b/api/internal/handler/adapters/getclusterhandler.go deleted file mode 100644 index 865e861f..00000000 --- a/api/internal/handler/adapters/getclusterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.FId - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewGetClusterLogic(r.Context(), svcCtx) - resp, err := l.GetCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/getclustersumhandler.go b/api/internal/handler/adapters/getclustersumhandler.go deleted file mode 100644 index 18fd747e..00000000 --- a/api/internal/handler/adapters/getclustersumhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetClusterSumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ClusterSumReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewGetClusterSumLogic(r.Context(), svcCtx) - resp, err := l.GetClusterSum(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/updateadapterhandler.go b/api/internal/handler/adapters/updateadapterhandler.go deleted file mode 100644 index 3800fc16..00000000 --- a/api/internal/handler/adapters/updateadapterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AdapterReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewUpdateAdapterLogic(r.Context(), svcCtx) - resp, err := l.UpdateAdapter(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/adapters/updateclusterhandler.go b/api/internal/handler/adapters/updateclusterhandler.go deleted file mode 100644 index f5405d64..00000000 --- a/api/internal/handler/adapters/updateclusterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package adapters - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ClusterCreateReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := adapters.NewUpdateClusterLogic(r.Context(), svcCtx) - resp, err := l.UpdateCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/createalgorithmhandler.go b/api/internal/handler/ai/createalgorithmhandler.go deleted file mode 100644 index e0ebcb34..00000000 --- a/api/internal/handler/ai/createalgorithmhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateAlgorithmReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewCreateAlgorithmLogic(r.Context(), svcCtx) - resp, err := l.CreateAlgorithm(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/createdatasethandler.go b/api/internal/handler/ai/createdatasethandler.go deleted file mode 100644 index 57bb2728..00000000 --- a/api/internal/handler/ai/createdatasethandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateDataSetReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewCreateDataSetLogic(r.Context(), svcCtx) - resp, err := l.CreateDataSet(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/createexporttaskhandler.go b/api/internal/handler/ai/createexporttaskhandler.go deleted file mode 100644 index bcc64381..00000000 --- a/api/internal/handler/ai/createexporttaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateExportTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateExportTaskReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewCreateExportTaskLogic(r.Context(), svcCtx) - resp, err := l.CreateExportTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/createnotebookhandler.go b/api/internal/handler/ai/createnotebookhandler.go deleted file mode 100644 index 4bf997fc..00000000 --- a/api/internal/handler/ai/createnotebookhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateNotebookReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewCreateNotebookLogic(r.Context(), svcCtx) - resp, err := l.CreateNotebook(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/createprocessortaskhandler.go b/api/internal/handler/ai/createprocessortaskhandler.go deleted file mode 100644 index b2dc6f55..00000000 --- a/api/internal/handler/ai/createprocessortaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateProcessorTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateProcessorTaskReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewCreateProcessorTaskLogic(r.Context(), svcCtx) - resp, err := l.CreateProcessorTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/createservicehandler.go b/api/internal/handler/ai/createservicehandler.go deleted file mode 100644 index dd8ef32a..00000000 --- a/api/internal/handler/ai/createservicehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateServiceReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewCreateServiceLogic(r.Context(), svcCtx) - resp, err := l.CreateService(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/createtaskhandler.go b/api/internal/handler/ai/createtaskhandler.go deleted file mode 100644 index c1632e63..00000000 --- a/api/internal/handler/ai/createtaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ImportTaskDataReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewCreateTaskLogic(r.Context(), svcCtx) - resp, err := l.CreateTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/createtrainingjobhandler.go b/api/internal/handler/ai/createtrainingjobhandler.go deleted file mode 100644 index f159bf06..00000000 --- a/api/internal/handler/ai/createtrainingjobhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateTrainingJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateTrainingJobReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewCreateTrainingJobLogic(r.Context(), svcCtx) - resp, err := l.CreateTrainingJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/createvisualizationjobhandler.go b/api/internal/handler/ai/createvisualizationjobhandler.go deleted file mode 100644 index b66ffa7c..00000000 --- a/api/internal/handler/ai/createvisualizationjobhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateVisualizationJobReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewCreateVisualizationJobLogic(r.Context(), svcCtx) - resp, err := l.CreateVisualizationJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/deletealgorithmhandler.go b/api/internal/handler/ai/deletealgorithmhandler.go deleted file mode 100644 index 57630af0..00000000 --- a/api/internal/handler/ai/deletealgorithmhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteAlgorithmReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewDeleteAlgorithmLogic(r.Context(), svcCtx) - resp, err := l.DeleteAlgorithm(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/deletedatasethandler.go b/api/internal/handler/ai/deletedatasethandler.go deleted file mode 100644 index 84288d1c..00000000 --- a/api/internal/handler/ai/deletedatasethandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteDataSetReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewDeleteDataSetLogic(r.Context(), svcCtx) - resp, err := l.DeleteDataSet(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/deleteservicehandler.go b/api/internal/handler/ai/deleteservicehandler.go deleted file mode 100644 index effb9aad..00000000 --- a/api/internal/handler/ai/deleteservicehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteServiceReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewDeleteServiceLogic(r.Context(), svcCtx) - resp, err := l.DeleteService(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/deletetrainingjobhandler.go b/api/internal/handler/ai/deletetrainingjobhandler.go deleted file mode 100644 index d0666ef7..00000000 --- a/api/internal/handler/ai/deletetrainingjobhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteTrainingJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteTrainingJobReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewDeleteTrainingJobLogic(r.Context(), svcCtx) - resp, err := l.DeleteTrainingJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/getexporttasksofdatasethandler.go b/api/internal/handler/ai/getexporttasksofdatasethandler.go deleted file mode 100644 index bf45832a..00000000 --- a/api/internal/handler/ai/getexporttasksofdatasethandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetExportTasksOfDatasetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetExportTasksOfDatasetReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewGetExportTasksOfDatasetLogic(r.Context(), svcCtx) - resp, err := l.GetExportTasksOfDataset(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go b/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go deleted file mode 100644 index 3a7c0337..00000000 --- a/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetExportTaskStatusOfDatasetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetExportTaskStatusOfDatasetReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewGetExportTaskStatusOfDatasetLogic(r.Context(), svcCtx) - resp, err := l.GetExportTaskStatusOfDataset(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/getlisttrainingjobshandler.go b/api/internal/handler/ai/getlisttrainingjobshandler.go deleted file mode 100644 index 3f978dba..00000000 --- a/api/internal/handler/ai/getlisttrainingjobshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetListTrainingJobsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListTrainingJobsreq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewGetListTrainingJobsLogic(r.Context(), svcCtx) - resp, err := l.GetListTrainingJobs(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/getnotebookstoragehandler.go b/api/internal/handler/ai/getnotebookstoragehandler.go deleted file mode 100644 index 2c7618c8..00000000 --- a/api/internal/handler/ai/getnotebookstoragehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetNotebookStorageReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewGetNotebookStorageLogic(r.Context(), svcCtx) - resp, err := l.GetNotebookStorage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/getvisualizationjobhandler.go b/api/internal/handler/ai/getvisualizationjobhandler.go deleted file mode 100644 index 51f41ed1..00000000 --- a/api/internal/handler/ai/getvisualizationjobhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetVisualizationJobReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewGetVisualizationJobLogic(r.Context(), svcCtx) - resp, err := l.GetVisualizationJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/listalgorithmshandler.go b/api/internal/handler/ai/listalgorithmshandler.go deleted file mode 100644 index 56c2ded7..00000000 --- a/api/internal/handler/ai/listalgorithmshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListAlgorithmsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListAlgorithmsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewListAlgorithmsLogic(r.Context(), svcCtx) - resp, err := l.ListAlgorithms(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/listclustershandler.go b/api/internal/handler/ai/listclustershandler.go deleted file mode 100644 index 50ad73bd..00000000 --- a/api/internal/handler/ai/listclustershandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListClustersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListClustersReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewListClustersLogic(r.Context(), svcCtx) - resp, err := l.ListClusters(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/listdatasethandler.go b/api/internal/handler/ai/listdatasethandler.go deleted file mode 100644 index 78f06ffa..00000000 --- a/api/internal/handler/ai/listdatasethandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DataSetReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewListDataSetLogic(r.Context(), svcCtx) - resp, err := l.ListDataSet(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/listimporthandler.go b/api/internal/handler/ai/listimporthandler.go deleted file mode 100644 index 32a8c6d0..00000000 --- a/api/internal/handler/ai/listimporthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListImportHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListImportTasksReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewListImportLogic(r.Context(), svcCtx) - resp, err := l.ListImport(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/listnotebookhandler.go b/api/internal/handler/ai/listnotebookhandler.go deleted file mode 100644 index b1375aeb..00000000 --- a/api/internal/handler/ai/listnotebookhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListNotebookReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewListNotebookLogic(r.Context(), svcCtx) - resp, err := l.ListNotebook(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/listserviceshandler.go b/api/internal/handler/ai/listserviceshandler.go deleted file mode 100644 index df823191..00000000 --- a/api/internal/handler/ai/listserviceshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListServicesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListServicesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewListServicesLogic(r.Context(), svcCtx) - resp, err := l.ListServices(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/mountnotebookstoragehandler.go b/api/internal/handler/ai/mountnotebookstoragehandler.go deleted file mode 100644 index 324c9708..00000000 --- a/api/internal/handler/ai/mountnotebookstoragehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func MountNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.MountNotebookStorageReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewMountNotebookStorageLogic(r.Context(), svcCtx) - resp, err := l.MountNotebookStorage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/showalgorithmbyuuidhandler.go b/api/internal/handler/ai/showalgorithmbyuuidhandler.go deleted file mode 100644 index a2951560..00000000 --- a/api/internal/handler/ai/showalgorithmbyuuidhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowAlgorithmByUuidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowAlgorithmByUuidReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewShowAlgorithmByUuidLogic(r.Context(), svcCtx) - resp, err := l.ShowAlgorithmByUuid(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/showservicehandler.go b/api/internal/handler/ai/showservicehandler.go deleted file mode 100644 index d6a9f4b4..00000000 --- a/api/internal/handler/ai/showservicehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowServiceReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewShowServiceLogic(r.Context(), svcCtx) - resp, err := l.ShowService(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/startnotebookhandler.go b/api/internal/handler/ai/startnotebookhandler.go deleted file mode 100644 index 1416d911..00000000 --- a/api/internal/handler/ai/startnotebookhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func StartNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.StartNotebookReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewStartNotebookLogic(r.Context(), svcCtx) - resp, err := l.StartNotebook(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/ai/stopnotebookhandler.go b/api/internal/handler/ai/stopnotebookhandler.go deleted file mode 100644 index b6fd7cce..00000000 --- a/api/internal/handler/ai/stopnotebookhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package ai - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func StopNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.StopNotebookReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := ai.NewStopNotebookLogic(r.Context(), svcCtx) - resp, err := l.StopNotebook(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/apps/appdetailhandler.go b/api/internal/handler/apps/appdetailhandler.go deleted file mode 100644 index d668a226..00000000 --- a/api/internal/handler/apps/appdetailhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package apps - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func AppDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AppDetailReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := apps.NewAppDetailLogic(r.Context(), svcCtx) - resp, err := l.AppDetail(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/apps/applisthandler.go b/api/internal/handler/apps/applisthandler.go deleted file mode 100644 index 823cb985..00000000 --- a/api/internal/handler/apps/applisthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package apps - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func AppListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AppListReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := apps.NewAppListLogic(r.Context(), svcCtx) - resp, err := l.AppList(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/apps/apppodshandler.go b/api/internal/handler/apps/apppodshandler.go deleted file mode 100644 index ef3e0466..00000000 --- a/api/internal/handler/apps/apppodshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package apps - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func AppPodsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AppDetailReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := apps.NewAppPodsLogic(r.Context(), svcCtx) - resp, err := l.AppPods(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/apps/deleteappbyappnamehandler.go b/api/internal/handler/apps/deleteappbyappnamehandler.go deleted file mode 100644 index a6c9efa6..00000000 --- a/api/internal/handler/apps/deleteappbyappnamehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package apps - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteAppReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := apps.NewDeleteAppByAppNameLogic(r.Context(), svcCtx) - resp, err := l.DeleteAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/apps/getappbyappnamehandler.go b/api/internal/handler/apps/getappbyappnamehandler.go deleted file mode 100644 index d7dd16c2..00000000 --- a/api/internal/handler/apps/getappbyappnamehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package apps - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AppDetailReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := apps.NewGetAppByAppNameLogic(r.Context(), svcCtx) - resp, err := l.GetAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/apps/pauseappbyappnamehandler.go b/api/internal/handler/apps/pauseappbyappnamehandler.go deleted file mode 100644 index a53de1ab..00000000 --- a/api/internal/handler/apps/pauseappbyappnamehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package apps - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func PauseAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteAppReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := apps.NewPauseAppByAppNameLogic(r.Context(), svcCtx) - resp, err := l.PauseAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/apps/restartappbyappnamehandler.go b/api/internal/handler/apps/restartappbyappnamehandler.go deleted file mode 100644 index 94b246af..00000000 --- a/api/internal/handler/apps/restartappbyappnamehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package apps - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func RestartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteAppReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := apps.NewRestartAppByAppNameLogic(r.Context(), svcCtx) - resp, err := l.RestartAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/apps/startappbyappnamehandler.go b/api/internal/handler/apps/startappbyappnamehandler.go deleted file mode 100644 index 02b6a98b..00000000 --- a/api/internal/handler/apps/startappbyappnamehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package apps - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func StartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteAppReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := apps.NewStartAppByAppNameLogic(r.Context(), svcCtx) - resp, err := l.StartAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/apps/updateappbyappnamehandler.go b/api/internal/handler/apps/updateappbyappnamehandler.go deleted file mode 100644 index e72740b8..00000000 --- a/api/internal/handler/apps/updateappbyappnamehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package apps - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteAppReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := apps.NewUpdateAppByAppNameLogic(r.Context(), svcCtx) - resp, err := l.UpdateAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/cloud/cloudlisthandler.go b/api/internal/handler/cloud/cloudlisthandler.go deleted file mode 100644 index 22c759c4..00000000 --- a/api/internal/handler/cloud/cloudlisthandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package cloud - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func CloudListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := cloud.NewCloudListLogic(r.Context(), svcCtx) - resp, err := l.CloudList() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/cloud/controllermetricshandler.go b/api/internal/handler/cloud/controllermetricshandler.go deleted file mode 100644 index 2e02cf43..00000000 --- a/api/internal/handler/cloud/controllermetricshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package cloud - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ControllerMetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ControllerMetricsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := cloud.NewControllerMetricsLogic(r.Context(), svcCtx) - resp, err := l.ControllerMetrics(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/cloud/deleteclusterhandler.go b/api/internal/handler/cloud/deleteclusterhandler.go deleted file mode 100644 index 323c25f3..00000000 --- a/api/internal/handler/cloud/deleteclusterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package cloud - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteClusterReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := cloud.NewDeleteClusterLogic(r.Context(), svcCtx) - resp, err := l.DeleteCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/cloud/deleteyamlhandler.go b/api/internal/handler/cloud/deleteyamlhandler.go deleted file mode 100644 index 60a01556..00000000 --- a/api/internal/handler/cloud/deleteyamlhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package cloud - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteYamlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ApplyReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := cloud.NewDeleteYamlLogic(r.Context(), svcCtx) - resp, err := l.DeleteYaml(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/cloud/getclusterlisthandler.go b/api/internal/handler/cloud/getclusterlisthandler.go deleted file mode 100644 index cc04e75d..00000000 --- a/api/internal/handler/cloud/getclusterlisthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package cloud - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetClusterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetClusterListReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := cloud.NewGetClusterListLogic(r.Context(), svcCtx) - resp, err := l.GetClusterList(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/cloud/noticetenanthandler.go b/api/internal/handler/cloud/noticetenanthandler.go deleted file mode 100644 index 9b3fea29..00000000 --- a/api/internal/handler/cloud/noticetenanthandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package cloud - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func NoticeTenantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := cloud.NewNoticeTenantLogic(r.Context(), svcCtx) - resp, err := l.NoticeTenant() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/cloud/registerclusterhandler.go b/api/internal/handler/cloud/registerclusterhandler.go deleted file mode 100644 index f222e5be..00000000 --- a/api/internal/handler/cloud/registerclusterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package cloud - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func RegisterClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.RegisterClusterReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := cloud.NewRegisterClusterLogic(r.Context(), svcCtx) - resp, err := l.RegisterCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/cloud/updatetenanthandler.go b/api/internal/handler/cloud/updatetenanthandler.go deleted file mode 100644 index 04b04e32..00000000 --- a/api/internal/handler/cloud/updatetenanthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package cloud - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateTenantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateTenantReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := cloud.NewUpdateTenantLogic(r.Context(), svcCtx) - resp, err := l.UpdateTenant(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/centerresourceshandler.go b/api/internal/handler/core/centerresourceshandler.go deleted file mode 100644 index 6c7ae71e..00000000 --- a/api/internal/handler/core/centerresourceshandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func CenterResourcesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewCenterResourcesLogic(r.Context(), svcCtx) - resp, err := l.CenterResources() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/committaskhandler.go b/api/internal/handler/core/committaskhandler.go deleted file mode 100644 index 3bea0b93..00000000 --- a/api/internal/handler/core/committaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CommitTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CommitTaskReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewCommitTaskLogic(r.Context(), svcCtx) - err := l.CommitTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } - } -} diff --git a/api/internal/handler/core/commitvmtaskhandler.go b/api/internal/handler/core/commitvmtaskhandler.go deleted file mode 100644 index f2ca9e4b..00000000 --- a/api/internal/handler/core/commitvmtaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CommitVmTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CommitVmTaskReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewCommitVmTaskLogic(r.Context(), svcCtx) - resp, err := l.CommitVmTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/deletetaskhandler.go b/api/internal/handler/core/deletetaskhandler.go deleted file mode 100644 index e5a735e0..00000000 --- a/api/internal/handler/core/deletetaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteTaskReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewDeleteTaskLogic(r.Context(), svcCtx) - err := l.DeleteTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } - } -} diff --git a/api/internal/handler/core/getcomputilitystatisticshandler.go b/api/internal/handler/core/getcomputilitystatisticshandler.go deleted file mode 100644 index 8a03ba36..00000000 --- a/api/internal/handler/core/getcomputilitystatisticshandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func GetComputilityStatisticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewGetComputilityStatisticsLogic(r.Context(), svcCtx) - resp, err := l.GetComputilityStatistics() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/getcomputingpowerhandler.go b/api/internal/handler/core/getcomputingpowerhandler.go deleted file mode 100644 index 9e4c77ed..00000000 --- a/api/internal/handler/core/getcomputingpowerhandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func GetComputingPowerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewGetComputingPowerLogic(r.Context(), svcCtx) - resp, err := l.GetComputingPower() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/getgeneralinfohandler.go b/api/internal/handler/core/getgeneralinfohandler.go deleted file mode 100644 index de4dc89f..00000000 --- a/api/internal/handler/core/getgeneralinfohandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func GetGeneralInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewGetGeneralInfoLogic(r.Context(), svcCtx) - resp, err := l.GetGeneralInfo() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/getregionhandler.go b/api/internal/handler/core/getregionhandler.go deleted file mode 100644 index f85e16c7..00000000 --- a/api/internal/handler/core/getregionhandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func GetRegionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewGetRegionLogic(r.Context(), svcCtx) - resp, err := l.GetRegion() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/getresourcepanelconfighandler.go b/api/internal/handler/core/getresourcepanelconfighandler.go deleted file mode 100644 index 45dde0c1..00000000 --- a/api/internal/handler/core/getresourcepanelconfighandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func GetResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewGetResourcePanelConfigLogic(r.Context(), svcCtx) - resp, err := l.GetResourcePanelConfig() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/jobtotalhandler.go b/api/internal/handler/core/jobtotalhandler.go deleted file mode 100644 index 91caa200..00000000 --- a/api/internal/handler/core/jobtotalhandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func JobTotalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewJobTotalLogic(r.Context(), svcCtx) - resp, err := l.JobTotal() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/listcenterhandler.go b/api/internal/handler/core/listcenterhandler.go deleted file mode 100644 index cf988c03..00000000 --- a/api/internal/handler/core/listcenterhandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ListCenterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewListCenterLogic(r.Context(), svcCtx) - resp, err := l.ListCenter() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/listclusterhandler.go b/api/internal/handler/core/listclusterhandler.go deleted file mode 100644 index a2077a06..00000000 --- a/api/internal/handler/core/listclusterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListClusterReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewListClusterLogic(r.Context(), svcCtx) - resp, err := l.ListCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/listdomainresourcehandler.go b/api/internal/handler/core/listdomainresourcehandler.go deleted file mode 100644 index 911beacf..00000000 --- a/api/internal/handler/core/listdomainresourcehandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ListDomainResourceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewListDomainResourceLogic(r.Context(), svcCtx) - resp, err := l.ListDomainResource() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/listregionhandler.go b/api/internal/handler/core/listregionhandler.go deleted file mode 100644 index c05760a6..00000000 --- a/api/internal/handler/core/listregionhandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ListRegionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewListRegionLogic(r.Context(), svcCtx) - resp, err := l.ListRegion() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/metricshandler.go b/api/internal/handler/core/metricshandler.go deleted file mode 100644 index 5f715b1d..00000000 --- a/api/internal/handler/core/metricshandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func MetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewMetricsLogic(r.Context(), svcCtx) - err := l.Metrics() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } - } -} diff --git a/api/internal/handler/core/nodeassetshandler.go b/api/internal/handler/core/nodeassetshandler.go deleted file mode 100644 index f8bd04a4..00000000 --- a/api/internal/handler/core/nodeassetshandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func NodeAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewNodeAssetsLogic(r.Context(), svcCtx) - resp, err := l.NodeAssets() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/participantlisthandler.go b/api/internal/handler/core/participantlisthandler.go deleted file mode 100644 index 1f122e0f..00000000 --- a/api/internal/handler/core/participantlisthandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ParticipantListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := core.NewParticipantListLogic(r.Context(), svcCtx) - resp, err := l.ParticipantList() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/pulltaskinfohandler.go b/api/internal/handler/core/pulltaskinfohandler.go deleted file mode 100644 index 87e8cccc..00000000 --- a/api/internal/handler/core/pulltaskinfohandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func PullTaskInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.PullTaskInfoReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewPullTaskInfoLogic(r.Context(), svcCtx) - resp, err := l.PullTaskInfo(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/pushtaskinfohandler.go b/api/internal/handler/core/pushtaskinfohandler.go deleted file mode 100644 index 68c4637d..00000000 --- a/api/internal/handler/core/pushtaskinfohandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func PushTaskInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.PushTaskInfoReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewPushTaskInfoLogic(r.Context(), svcCtx) - resp, err := l.PushTaskInfo(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/putresourcepanelconfighandler.go b/api/internal/handler/core/putresourcepanelconfighandler.go deleted file mode 100644 index a425f19a..00000000 --- a/api/internal/handler/core/putresourcepanelconfighandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func PutResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ResourcePanelConfigReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewPutResourcePanelConfigLogic(r.Context(), svcCtx) - err := l.PutResourcePanelConfig(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } - } -} diff --git a/api/internal/handler/core/scheduletaskbyyamlhandler.go b/api/internal/handler/core/scheduletaskbyyamlhandler.go deleted file mode 100644 index 1841a389..00000000 --- a/api/internal/handler/core/scheduletaskbyyamlhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ScheduleTaskByYamlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ScheduleTaskByYamlReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewScheduleTaskByYamlLogic(r.Context(), svcCtx) - err := l.ScheduleTaskByYaml(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } - } -} diff --git a/api/internal/handler/core/syncclusterloadhandler.go b/api/internal/handler/core/syncclusterloadhandler.go deleted file mode 100644 index ff36e15b..00000000 --- a/api/internal/handler/core/syncclusterloadhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func SyncClusterLoadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.SyncClusterLoadReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewSyncClusterLoadLogic(r.Context(), svcCtx) - err := l.SyncClusterLoad(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } - } -} diff --git a/api/internal/handler/core/taskdetailhandler.go b/api/internal/handler/core/taskdetailhandler.go deleted file mode 100644 index e97f2706..00000000 --- a/api/internal/handler/core/taskdetailhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func TaskDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.TaskDetailReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewTaskDetailLogic(r.Context(), svcCtx) - resp, err := l.TaskDetail(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/core/tasklisthandler.go b/api/internal/handler/core/tasklisthandler.go deleted file mode 100644 index 7b239009..00000000 --- a/api/internal/handler/core/tasklisthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package core - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func TaskListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.TaskListReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := core.NewTaskListLogic(r.Context(), svcCtx) - resp, err := l.TaskList(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/adddicthandler.go b/api/internal/handler/dictionary/adddicthandler.go deleted file mode 100644 index 9abc0f7a..00000000 --- a/api/internal/handler/dictionary/adddicthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func AddDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DictEditReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewAddDictLogic(r.Context(), svcCtx) - resp, err := l.AddDict(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/adddictitemhandler.go b/api/internal/handler/dictionary/adddictitemhandler.go deleted file mode 100644 index c1ab2c69..00000000 --- a/api/internal/handler/dictionary/adddictitemhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func AddDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DictItemEditReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewAddDictItemLogic(r.Context(), svcCtx) - resp, err := l.AddDictItem(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/deletedicthandler.go b/api/internal/handler/dictionary/deletedicthandler.go deleted file mode 100644 index 435f529e..00000000 --- a/api/internal/handler/dictionary/deletedicthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CId - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewDeleteDictLogic(r.Context(), svcCtx) - resp, err := l.DeleteDict(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/deletedictitemhandler.go b/api/internal/handler/dictionary/deletedictitemhandler.go deleted file mode 100644 index e029202f..00000000 --- a/api/internal/handler/dictionary/deletedictitemhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CId - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewDeleteDictItemLogic(r.Context(), svcCtx) - resp, err := l.DeleteDictItem(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/editdicthandler.go b/api/internal/handler/dictionary/editdicthandler.go deleted file mode 100644 index b63e41be..00000000 --- a/api/internal/handler/dictionary/editdicthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func EditDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DictEditReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewEditDictLogic(r.Context(), svcCtx) - resp, err := l.EditDict(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/editdictitemhandler.go b/api/internal/handler/dictionary/editdictitemhandler.go deleted file mode 100644 index f4f2fd6c..00000000 --- a/api/internal/handler/dictionary/editdictitemhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func EditDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DictItemEditReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewEditDictItemLogic(r.Context(), svcCtx) - resp, err := l.EditDictItem(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/getdicthandler.go b/api/internal/handler/dictionary/getdicthandler.go deleted file mode 100644 index 4a958990..00000000 --- a/api/internal/handler/dictionary/getdicthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CId - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewGetDictLogic(r.Context(), svcCtx) - resp, err := l.GetDict(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/getdictitemhandler.go b/api/internal/handler/dictionary/getdictitemhandler.go deleted file mode 100644 index 60d8ce06..00000000 --- a/api/internal/handler/dictionary/getdictitemhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CId - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewGetDictItemLogic(r.Context(), svcCtx) - resp, err := l.GetDictItem(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/listdicthandler.go b/api/internal/handler/dictionary/listdicthandler.go deleted file mode 100644 index 5c34a136..00000000 --- a/api/internal/handler/dictionary/listdicthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DictReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewListDictLogic(r.Context(), svcCtx) - resp, err := l.ListDict(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/listdictitembycodehandler.go b/api/internal/handler/dictionary/listdictitembycodehandler.go deleted file mode 100644 index 98c6feab..00000000 --- a/api/internal/handler/dictionary/listdictitembycodehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListDictItemByCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DictCodeReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewListDictItemByCodeLogic(r.Context(), svcCtx) - resp, err := l.ListDictItemByCode(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/dictionary/listdictitemhandler.go b/api/internal/handler/dictionary/listdictitemhandler.go deleted file mode 100644 index 5607ee04..00000000 --- a/api/internal/handler/dictionary/listdictitemhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package dictionary - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DictItemReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := dictionary.NewListDictItemLogic(r.Context(), svcCtx) - resp, err := l.ListDictItem(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/hpc/commithpctaskhandler.go b/api/internal/handler/hpc/commithpctaskhandler.go deleted file mode 100644 index a2043def..00000000 --- a/api/internal/handler/hpc/commithpctaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package hpc - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CommitHpcTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CommitHpcTaskReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := hpc.NewCommitHpcTaskLogic(r.Context(), svcCtx) - resp, err := l.CommitHpcTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/hpc/listhistoryjobhandler.go b/api/internal/handler/hpc/listhistoryjobhandler.go deleted file mode 100644 index ec50c854..00000000 --- a/api/internal/handler/hpc/listhistoryjobhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package hpc - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListHistoryJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListHistoryJobReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := hpc.NewListHistoryJobLogic(r.Context(), svcCtx) - resp, err := l.ListHistoryJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/hpc/listjobhandler.go b/api/internal/handler/hpc/listjobhandler.go deleted file mode 100644 index c9572a7e..00000000 --- a/api/internal/handler/hpc/listjobhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package hpc - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListJobReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := hpc.NewListJobLogic(r.Context(), svcCtx) - resp, err := l.ListJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/hpc/queueassetshandler.go b/api/internal/handler/hpc/queueassetshandler.go deleted file mode 100644 index 97c0c5d4..00000000 --- a/api/internal/handler/hpc/queueassetshandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package hpc - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func QueueAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := hpc.NewQueueAssetsLogic(r.Context(), svcCtx) - resp, err := l.QueueAssets() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/image/chunkhandler.go b/api/internal/handler/image/chunkhandler.go deleted file mode 100644 index 87c8b143..00000000 --- a/api/internal/handler/image/chunkhandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package image - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ChunkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := image.NewChunkLogic(r.Context(), svcCtx) - err := l.Chunk() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } - } -} diff --git a/api/internal/handler/image/datasetcheckhandler.go b/api/internal/handler/image/datasetcheckhandler.go deleted file mode 100644 index b127987b..00000000 --- a/api/internal/handler/image/datasetcheckhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package image - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DataSetCheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CheckReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := image.NewDataSetCheckLogic(r.Context(), svcCtx) - resp, err := l.DataSetCheck(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/image/imagelisthandler.go b/api/internal/handler/image/imagelisthandler.go deleted file mode 100644 index cbd14726..00000000 --- a/api/internal/handler/image/imagelisthandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package image - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ImageListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := image.NewImageListLogic(r.Context(), svcCtx) - resp, err := l.ImageList() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/image/uploaddatasethandler.go b/api/internal/handler/image/uploaddatasethandler.go deleted file mode 100644 index ffe715c6..00000000 --- a/api/internal/handler/image/uploaddatasethandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package image - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func UploadDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := image.NewUploadDataSetLogic(r.Context(), svcCtx) - err := l.UploadDataSet() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } - } -} diff --git a/api/internal/handler/image/uploadhandler.go b/api/internal/handler/image/uploadhandler.go deleted file mode 100644 index 66cd4592..00000000 --- a/api/internal/handler/image/uploadhandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package image - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func UploadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := image.NewUploadLogic(r.Context(), svcCtx) - err := l.Upload() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } - } -} diff --git a/api/internal/handler/routes.go b/api/internal/handler/routes.go deleted file mode 100644 index 50f31d6c..00000000 --- a/api/internal/handler/routes.go +++ /dev/null @@ -1,1166 +0,0 @@ -// Code generated by goctl. DO NOT EDIT. -package handler - -import ( - "net/http" - - adapters "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/adapters" - ai "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/ai" - apps "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/apps" - cloud "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/cloud" - core "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/core" - dictionary "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/dictionary" - hpc "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/hpc" - image "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/image" - schedule "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/schedule" - storage "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/storage" - storelink "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/storelink" - vm "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - - "github.com/zeromicro/go-zero/rest" -) - -func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodGet, - Path: "/core/participantList", - Handler: core.ParticipantListHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/core/scheduleTaskByYaml", - Handler: core.ScheduleTaskByYamlHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/core/commitTask", - Handler: core.CommitTaskHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/core/commitVmTask", - Handler: core.CommitVmTaskHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/core/deleteTask/:id", - Handler: core.DeleteTaskHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/taskList", - Handler: core.TaskListHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/taskDetail/:taskId", - Handler: core.TaskDetailHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/jobTotal", - Handler: core.JobTotalHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/listCenter", - Handler: core.ListCenterHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/listCluster/:centerId", - Handler: core.ListClusterHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/getRegion", - Handler: core.GetRegionHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/listRegion", - Handler: core.ListRegionHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/getComputingPower", - Handler: core.GetComputingPowerHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/getGeneralInfo", - Handler: core.GetGeneralInfoHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/listDomainResource", - Handler: core.ListDomainResourceHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/getResourcePanelConfigHandler", - Handler: core.GetResourcePanelConfigHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/core/resourcePanelConfigHandler", - Handler: core.PutResourcePanelConfigHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/getComputilityStatistics", - Handler: core.GetComputilityStatisticsHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/assets", - Handler: core.NodeAssetsHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/centerResources", - Handler: core.CenterResourcesHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/core/syncClusterLoad", - Handler: core.SyncClusterLoadHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/metrics", - Handler: core.MetricsHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/pullTaskInfo", - Handler: core.PullTaskInfoHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/core/pushTaskInfo", - Handler: core.PushTaskInfoHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodPost, - Path: "/hpc/commitHpcTask", - Handler: hpc.CommitHpcTaskHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/hpc/listJob", - Handler: hpc.ListJobHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/hpc/listHistoryJob", - Handler: hpc.ListHistoryJobHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/hpc/queueAssets", - Handler: hpc.QueueAssetsHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodGet, - Path: "/task/list", - Handler: cloud.CloudListHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/cloud/DeleteYaml", - Handler: cloud.DeleteYamlHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/cloud/controller/Metrics", - Handler: cloud.ControllerMetricsHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/cloud/registerCluster", - Handler: cloud.RegisterClusterHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/cloud/deleteCluster", - Handler: cloud.DeleteClusterHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/cloud/noticeTenant", - Handler: cloud.NoticeTenantHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/cloud/updateTenant", - Handler: cloud.UpdateTenantHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/core/clusterList", - Handler: cloud.GetClusterListHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodGet, - Path: "/ai/listDataSet/:projectId", - Handler: ai.ListDataSetHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/createDataSet/:projectId", - Handler: ai.CreateDataSetHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/ai/deleteDataSet/:projectId/:datasetId", - Handler: ai.DeleteDataSetHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/CreateTask/:projectId/:datasetId", - Handler: ai.CreateTaskHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/ListImport/:projectId/:datasetId", - Handler: ai.ListImportHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/GetListTrainingJobs/:projectId", - Handler: ai.GetListTrainingJobsHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/ai/DeleteTrainingJob/:projectId/:trainingJobId", - Handler: ai.DeleteTrainingJobHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/CreateAlgorithm/:projectId", - Handler: ai.CreateAlgorithmHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/ListAlgorithms/:projectId", - Handler: ai.ListAlgorithmsHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/ai/DeleteAlgorithm/:projectId/:algorithmId", - Handler: ai.DeleteAlgorithmHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/CreateTrainingJob/:projectId", - Handler: ai.CreateTrainingJobHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/ShowAlgorithmByUuid/:projectId/:algorithmId", - Handler: ai.ShowAlgorithmByUuidHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/CreateExportTask/:projectId/:datasetId", - Handler: ai.CreateExportTaskHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/GetExportTasksOfDataset/:projectId/:datasetId", - Handler: ai.GetExportTasksOfDatasetHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/GetExportTaskStatusOfDataset/:projectId/:resourceId/:taskId", - Handler: ai.GetExportTaskStatusOfDatasetHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/CreateProcessorTask", - Handler: ai.CreateProcessorTaskHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/CreateService/:projectId", - Handler: ai.CreateServiceHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/ListServices/:projectId", - Handler: ai.ListServicesHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/ShowService/:projectId/:serviceId", - Handler: ai.ShowServiceHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/ai/DeleteService/:projectId/:serviceId", - Handler: ai.DeleteServiceHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/ListClusters", - Handler: ai.ListClustersHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/listNotebook", - Handler: ai.ListNotebookHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/createNotebook", - Handler: ai.CreateNotebookHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/startNotebook", - Handler: ai.StartNotebookHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/stopNotebook", - Handler: ai.StopNotebookHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/getNotebookStorage", - Handler: ai.GetNotebookStorageHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/mountNotebookStorage", - Handler: ai.MountNotebookStorageHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/ai/getVisualizationJob", - Handler: ai.GetVisualizationJobHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/ai/CreateVisualizationJob", - Handler: ai.CreateVisualizationJobHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodGet, - Path: "/storage/screenStorage", - Handler: storage.ScreenStorageHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/storage/dailyPowerScreen", - Handler: storage.DailyPowerScreenHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/storage/perCenterComputerPowers", - Handler: storage.PerCenterComputerPowersHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodPost, - Path: "/upload", - Handler: image.UploadHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/chunk", - Handler: image.ChunkHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/image/list", - Handler: image.ImageListHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/dataSet/check/:fileMd5", - Handler: image.DataSetCheckHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/dataSet/upload", - Handler: image.UploadDataSetHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodGet, - Path: "/vm/getComputeLimits", - Handler: vm.GetComputeLimitsHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/getVolumeLimits", - Handler: vm.GetVolumeLimitsHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/getNetworkNum", - Handler: vm.GetNetworkNumHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/getImageNum", - Handler: vm.GetImageNumHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listServer", - Handler: vm.ListServerHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listServersDetailed", - Handler: vm.ListServersDetailedHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteServer", - Handler: vm.DeleteServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createServer", - Handler: vm.CreateServerHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/getServersDetailedById", - Handler: vm.GetServersDetailedByIdHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updateServer", - Handler: vm.UpdateServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/startServer", - Handler: vm.StartServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/stopServer", - Handler: vm.StopServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/rebootServer", - Handler: vm.RebootServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/pauseServer", - Handler: vm.PauseServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/unpauseServer", - Handler: vm.UnpauseServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/resizeServer", - Handler: vm.ResizeServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/migrateServer", - Handler: vm.MigrateServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/shelveServer", - Handler: vm.ShelveServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/changeAdministrativePassword", - Handler: vm.ChangeAdministrativePasswordHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/rescueServer", - Handler: vm.RescueServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/unRescueServer", - Handler: vm.UnRescueHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/suspendServer", - Handler: vm.SuspendServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/addSecurityGroupToServer", - Handler: vm.AddSecurityGroupToServerHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/removeSecurityGroup", - Handler: vm.RemoveSecurityGroupHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createFlavor", - Handler: vm.CreateFlavorHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/deleteFlavor", - Handler: vm.DeleteFlavorHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listImages", - Handler: vm.ListImagesHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteImage", - Handler: vm.DeleteImageHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createImage", - Handler: vm.CreateImageHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/uploadImage", - Handler: vm.UploadImageHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listNetworks", - Handler: vm.ListNetworksHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteNetwork", - Handler: vm.DeleteNetworkHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createNetwork", - Handler: vm.CreateNetworkHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createSubnet", - Handler: vm.CreateSubnetHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showNetworkDetails", - Handler: vm.ShowNetworkDetailsHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updateNetwork", - Handler: vm.UpdateNetworkHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/bulkCreateNetworks", - Handler: vm.BulkCreateNetworksHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listSubnets", - Handler: vm.ListSubnetsHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteSubnet", - Handler: vm.DeleteSubnetHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updateSubnet", - Handler: vm.UpdateSubnetHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listNetworkSegmentRanges", - Handler: vm.ListNetworkSegmentRangesRangeHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createNetworkSegmentRange", - Handler: vm.CreateNetworkSegmentRangeHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteNetworkSegmentRanges", - Handler: vm.DeleteNetworkSegmentRangesHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updateNetworkSegmentRanges", - Handler: vm.UpdateNetworkSegmentRangesHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showNetworkSegmentRangeDetails", - Handler: vm.ShowNetworkSegmentRangeDetailsHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createPort", - Handler: vm.CreatePortHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listPortsReq", - Handler: vm.ListPortsHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deletePort", - Handler: vm.DeletePortHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updatePort", - Handler: vm.UpdatePortHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showPortDetails", - Handler: vm.ShowPortDetailsHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createRouter", - Handler: vm.CreateRouterHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listRouters", - Handler: vm.ListRoutersHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteRouter", - Handler: vm.DeleteRouterHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updateRouter", - Handler: vm.UpdateRouterHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showRouterDetails", - Handler: vm.ShowRouterDetailsHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createFloatingIP", - Handler: vm.CreateFloatingIPHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listFloatingIPs", - Handler: vm.ListFloatingIPsHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteFloatingIP", - Handler: vm.DeleteFloatingIPHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updateFloatingIP", - Handler: vm.UpdateFloatingIPHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showFloatingIPDetails", - Handler: vm.ShowFloatingIPDetailsHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createFirewallGroup", - Handler: vm.CreateFirewallGroupHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listFirewallGroups", - Handler: vm.ListFirewallGroupsHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteFirewallGroup", - Handler: vm.DeleteFirewallGroupHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updateFirewallGroup", - Handler: vm.UpdateFirewallGroupHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showFirewallGroupDetails", - Handler: vm.ShowFirewallGroupDetailsHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createFirewallPolicy", - Handler: vm.CreateFirewallPolicyHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listFirewallPolicies", - Handler: vm.ListFirewallPoliciesHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteFirewallPolicy", - Handler: vm.DeleteFirewallPolicyHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showFirewallRuleDetails", - Handler: vm.ShowFirewallRuleDetailsHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showFirewallPolicyDetails", - Handler: vm.ShowFirewallPolicyDetailsHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createFirewallRule", - Handler: vm.CreateFirewallRuleHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listFirewallRules", - Handler: vm.ListFirewallRulesHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteFirewallRule", - Handler: vm.DeleteFirewallRuleHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createSecurityGroup", - Handler: vm.CreateSecurityGroupHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listSecurityGroups", - Handler: vm.ListSecurityGroupsHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteSecurityGroup", - Handler: vm.DeleteSecurityGroupHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updateSecurityGroup", - Handler: vm.UpdateSecurityGroupHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showSecurityGroup", - Handler: vm.ShowSecurityGroupHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createSecurityGroupRule", - Handler: vm.CreateSecurityGroupRuleHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listSecurityGroupRules", - Handler: vm.ListSecurityGroupRulesHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteSecurityGroupRule", - Handler: vm.DeleteSecurityGroupRuleHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showSecurityGroupRule", - Handler: vm.ShowSecurityGroupRuleHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listVolumesDetail", - Handler: vm.ListVolumesDetailHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteVolume", - Handler: vm.DeleteVolumeHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createVolume", - Handler: vm.CreateVolumeHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listFlavorsDetail", - Handler: vm.ListFlavorsDetailHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listVolumeTypes", - Handler: vm.ListVolumeTypesHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/vm/updateVolume", - Handler: vm.UpdateVolumeHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createVolumeTypes", - Handler: vm.CreateVolumeTypesHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteVolumeType", - Handler: vm.DeleteVolumeTypeHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listVolumes", - Handler: vm.ListVolumesHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/getVolumeDetailedById", - Handler: vm.GetVolumeDetailedByIdHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/listNodes", - Handler: vm.ListNodesHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/vm/createNode", - Handler: vm.CreateNodeHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/vm/deleteNode", - Handler: vm.DeleteNodeHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/vm/showNodeDetails", - Handler: vm.ShowNodeDetailsHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodPost, - Path: "/storelink/uploadImage", - Handler: storelink.UploadLinkImageHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/storelink/getImageList", - Handler: storelink.GetLinkImageListHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/storelink/deleteImage", - Handler: storelink.DeleteLinkImageHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/storelink/submitTask", - Handler: storelink.SubmitLinkTaskHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/storelink/getTask", - Handler: storelink.GetLinkTaskHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/storelink/deleteTask", - Handler: storelink.DeleteLinkTaskHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/storelink/getParticipants", - Handler: storelink.GetParticipantsHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/storelink/getResourceSpecs", - Handler: storelink.GetAISpecsHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodGet, - Path: "/apps/list", - Handler: apps.AppListHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/apps/distribute/:appName", - Handler: apps.AppDetailHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/apps/pods/:appName", - Handler: apps.AppPodsHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/apps/getAppByAppName/:appName", - Handler: apps.GetAppByAppNameHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/apps/deleteApp", - Handler: apps.DeleteAppByAppNameHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/apps/updateApp", - Handler: apps.UpdateAppByAppNameHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/apps/restartApp", - Handler: apps.RestartAppByAppNameHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/apps/pauseApp", - Handler: apps.PauseAppByAppNameHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/apps/startApp", - Handler: apps.StartAppByAppNameHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodGet, - Path: "/adapter/list", - Handler: adapters.AdaptersListHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/adapter/create", - Handler: adapters.CreateAdapterHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/adapter/update", - Handler: adapters.UpdateAdapterHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/adapter/delete", - Handler: adapters.DeleteAdapterHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/adapter/get", - Handler: adapters.GetAdapterHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/adapter/cluster/list", - Handler: adapters.ClusterListHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/adapter/cluster/create", - Handler: adapters.CreateClusterHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/adapter/cluster/update", - Handler: adapters.UpdateClusterHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/adapter/cluster/delete", - Handler: adapters.DeleteClusterHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/adapter/cluster/get", - Handler: adapters.GetClusterHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/adapter/relation", - Handler: adapters.GetAdapterRelationHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/adapter/clusterSum", - Handler: adapters.GetClusterSumHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodGet, - Path: "/schedule/ai/getResourceTypes", - Handler: schedule.ScheduleGetAiResourceTypesHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/schedule/ai/getTaskTypes", - Handler: schedule.ScheduleGetAiTaskTypesHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/schedule/ai/getDatasets", - Handler: schedule.ScheduleGetDatasetsHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/schedule/ai/getStrategies", - Handler: schedule.ScheduleGetStrategyHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/schedule/submit", - Handler: schedule.ScheduleSubmitHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) - - server.AddRoutes( - []rest.Route{ - { - Method: http.MethodGet, - Path: "/dict/:id", - Handler: dictionary.GetDictHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/dicts", - Handler: dictionary.ListDictHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/dict", - Handler: dictionary.AddDictHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/dict", - Handler: dictionary.EditDictHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/dict/:id", - Handler: dictionary.DeleteDictHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/dictItem/:id", - Handler: dictionary.GetDictItemHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/dictItems", - Handler: dictionary.ListDictItemHandler(serverCtx), - }, - { - Method: http.MethodPost, - Path: "/dictItem", - Handler: dictionary.AddDictItemHandler(serverCtx), - }, - { - Method: http.MethodPut, - Path: "/dictItem", - Handler: dictionary.EditDictItemHandler(serverCtx), - }, - { - Method: http.MethodDelete, - Path: "/dictItem/:id", - Handler: dictionary.DeleteDictItemHandler(serverCtx), - }, - { - Method: http.MethodGet, - Path: "/dictItem/code/:dictCode", - Handler: dictionary.ListDictItemByCodeHandler(serverCtx), - }, - }, - rest.WithPrefix("/pcm/v1"), - ) -} diff --git a/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go b/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go deleted file mode 100644 index 430786f2..00000000 --- a/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package schedule - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ScheduleGetAiResourceTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := schedule.NewScheduleGetAiResourceTypesLogic(r.Context(), svcCtx) - resp, err := l.ScheduleGetAiResourceTypes() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/schedule/schedulegetaitasktypeshandler.go b/api/internal/handler/schedule/schedulegetaitasktypeshandler.go deleted file mode 100644 index 5be11070..00000000 --- a/api/internal/handler/schedule/schedulegetaitasktypeshandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package schedule - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ScheduleGetAiTaskTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := schedule.NewScheduleGetAiTaskTypesLogic(r.Context(), svcCtx) - resp, err := l.ScheduleGetAiTaskTypes() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/schedule/schedulegetdatasetshandler.go b/api/internal/handler/schedule/schedulegetdatasetshandler.go deleted file mode 100644 index da285546..00000000 --- a/api/internal/handler/schedule/schedulegetdatasetshandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package schedule - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ScheduleGetDatasetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := schedule.NewScheduleGetDatasetsLogic(r.Context(), svcCtx) - resp, err := l.ScheduleGetDatasets() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/schedule/schedulegetstrategyhandler.go b/api/internal/handler/schedule/schedulegetstrategyhandler.go deleted file mode 100644 index 2ee88fba..00000000 --- a/api/internal/handler/schedule/schedulegetstrategyhandler.go +++ /dev/null @@ -1,21 +0,0 @@ -package schedule - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" -) - -func ScheduleGetStrategyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - l := schedule.NewScheduleGetStrategyLogic(r.Context(), svcCtx) - resp, err := l.ScheduleGetStrategy() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/schedule/schedulesubmithandler.go b/api/internal/handler/schedule/schedulesubmithandler.go deleted file mode 100644 index a536f649..00000000 --- a/api/internal/handler/schedule/schedulesubmithandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package schedule - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ScheduleSubmitHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ScheduleReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := schedule.NewScheduleSubmitLogic(r.Context(), svcCtx) - resp, err := l.ScheduleSubmit(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storage/dailypowerscreenhandler.go b/api/internal/handler/storage/dailypowerscreenhandler.go deleted file mode 100644 index 48844f39..00000000 --- a/api/internal/handler/storage/dailypowerscreenhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storage - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storage" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DailyPowerScreenHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DailyPowerScreenReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storage.NewDailyPowerScreenLogic(r.Context(), svcCtx) - resp, err := l.DailyPowerScreen(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storage/percentercomputerpowershandler.go b/api/internal/handler/storage/percentercomputerpowershandler.go deleted file mode 100644 index 2e1b5f78..00000000 --- a/api/internal/handler/storage/percentercomputerpowershandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storage - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storage" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func PerCenterComputerPowersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.PerCenterComputerPowersReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storage.NewPerCenterComputerPowersLogic(r.Context(), svcCtx) - resp, err := l.PerCenterComputerPowers(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storage/screenstoragehandler.go b/api/internal/handler/storage/screenstoragehandler.go deleted file mode 100644 index 8a8a2bec..00000000 --- a/api/internal/handler/storage/screenstoragehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storage - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storage" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ScreenStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.StorageScreenReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storage.NewScreenStorageLogic(r.Context(), svcCtx) - resp, err := l.ScreenStorage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storelink/deletelinkimagehandler.go b/api/internal/handler/storelink/deletelinkimagehandler.go deleted file mode 100644 index fc56fe9d..00000000 --- a/api/internal/handler/storelink/deletelinkimagehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storelink - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteLinkImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteLinkImageReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storelink.NewDeleteLinkImageLogic(r.Context(), svcCtx) - resp, err := l.DeleteLinkImage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storelink/deletelinktaskhandler.go b/api/internal/handler/storelink/deletelinktaskhandler.go deleted file mode 100644 index 536b3ae9..00000000 --- a/api/internal/handler/storelink/deletelinktaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storelink - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteLinkTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteLinkTaskReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storelink.NewDeleteLinkTaskLogic(r.Context(), svcCtx) - resp, err := l.DeleteLinkTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storelink/getaispecshandler.go b/api/internal/handler/storelink/getaispecshandler.go deleted file mode 100644 index 8e97d294..00000000 --- a/api/internal/handler/storelink/getaispecshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storelink - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetAISpecsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetResourceSpecsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storelink.NewGetAISpecsLogic(r.Context(), svcCtx) - resp, err := l.GetAISpecs(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storelink/getlinkimagelisthandler.go b/api/internal/handler/storelink/getlinkimagelisthandler.go deleted file mode 100644 index b83198f6..00000000 --- a/api/internal/handler/storelink/getlinkimagelisthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storelink - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetLinkImageListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetLinkImageListReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storelink.NewGetLinkImageListLogic(r.Context(), svcCtx) - resp, err := l.GetLinkImageList(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storelink/getlinktaskhandler.go b/api/internal/handler/storelink/getlinktaskhandler.go deleted file mode 100644 index af477e23..00000000 --- a/api/internal/handler/storelink/getlinktaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storelink - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetLinkTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetLinkTaskReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storelink.NewGetLinkTaskLogic(r.Context(), svcCtx) - resp, err := l.GetLinkTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storelink/getparticipantshandler.go b/api/internal/handler/storelink/getparticipantshandler.go deleted file mode 100644 index 07c88f83..00000000 --- a/api/internal/handler/storelink/getparticipantshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storelink - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetParticipantsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetParticipantsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storelink.NewGetParticipantsLogic(r.Context(), svcCtx) - resp, err := l.GetParticipants(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storelink/submitlinktaskhandler.go b/api/internal/handler/storelink/submitlinktaskhandler.go deleted file mode 100644 index 5da13f4b..00000000 --- a/api/internal/handler/storelink/submitlinktaskhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storelink - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func SubmitLinkTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.SubmitLinkTaskReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storelink.NewSubmitLinkTaskLogic(r.Context(), svcCtx) - resp, err := l.SubmitLinkTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/storelink/uploadlinkimagehandler.go b/api/internal/handler/storelink/uploadlinkimagehandler.go deleted file mode 100644 index 9adec263..00000000 --- a/api/internal/handler/storelink/uploadlinkimagehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package storelink - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UploadLinkImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UploadLinkImageReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := storelink.NewUploadLinkImageLogic(r.Context(), svcCtx) - resp, err := l.UploadLinkImage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/addsecuritygrouptoserverhandler.go b/api/internal/handler/vm/addsecuritygrouptoserverhandler.go deleted file mode 100644 index 86553cbf..00000000 --- a/api/internal/handler/vm/addsecuritygrouptoserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func AddSecurityGroupToServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.AddSecurityGroupToServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewAddSecurityGroupToServerLogic(r.Context(), svcCtx) - resp, err := l.AddSecurityGroupToServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/bulkcreatenetworkshandler.go b/api/internal/handler/vm/bulkcreatenetworkshandler.go deleted file mode 100644 index 84cad5c6..00000000 --- a/api/internal/handler/vm/bulkcreatenetworkshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func BulkCreateNetworksHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.BulkCreateNetworksReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewBulkCreateNetworksLogic(r.Context(), svcCtx) - resp, err := l.BulkCreateNetworks(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/changeadministrativepasswordhandler.go b/api/internal/handler/vm/changeadministrativepasswordhandler.go deleted file mode 100644 index ecf1c6bc..00000000 --- a/api/internal/handler/vm/changeadministrativepasswordhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ChangeAdministrativePasswordHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ChangeAdministrativePasswordReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewChangeAdministrativePasswordLogic(r.Context(), svcCtx) - resp, err := l.ChangeAdministrativePassword(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createfirewallgrouphandler.go b/api/internal/handler/vm/createfirewallgrouphandler.go deleted file mode 100644 index f6f5b3a1..00000000 --- a/api/internal/handler/vm/createfirewallgrouphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateFirewallGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateFirewallGroupReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateFirewallGroupLogic(r.Context(), svcCtx) - resp, err := l.CreateFirewallGroup(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createfirewallpolicyhandler.go b/api/internal/handler/vm/createfirewallpolicyhandler.go deleted file mode 100644 index 77d8d1cf..00000000 --- a/api/internal/handler/vm/createfirewallpolicyhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateFirewallPolicyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateFirewallPolicyReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateFirewallPolicyLogic(r.Context(), svcCtx) - resp, err := l.CreateFirewallPolicy(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createfirewallrulehandler.go b/api/internal/handler/vm/createfirewallrulehandler.go deleted file mode 100644 index 3995c08a..00000000 --- a/api/internal/handler/vm/createfirewallrulehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateFirewallRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateFirewallRuleReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateFirewallRuleLogic(r.Context(), svcCtx) - resp, err := l.CreateFirewallRule(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createflavorhandler.go b/api/internal/handler/vm/createflavorhandler.go deleted file mode 100644 index f32dc8f2..00000000 --- a/api/internal/handler/vm/createflavorhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateFlavorHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateFlavorReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateFlavorLogic(r.Context(), svcCtx) - resp, err := l.CreateFlavor(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createfloatingiphandler.go b/api/internal/handler/vm/createfloatingiphandler.go deleted file mode 100644 index 797a4a55..00000000 --- a/api/internal/handler/vm/createfloatingiphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateFloatingIPHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateFloatingIPReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateFloatingIPLogic(r.Context(), svcCtx) - resp, err := l.CreateFloatingIP(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createimagehandler.go b/api/internal/handler/vm/createimagehandler.go deleted file mode 100644 index 5f5e4f81..00000000 --- a/api/internal/handler/vm/createimagehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateImageReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateImageLogic(r.Context(), svcCtx) - resp, err := l.CreateImage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createnetworkhandler.go b/api/internal/handler/vm/createnetworkhandler.go deleted file mode 100644 index 2da207be..00000000 --- a/api/internal/handler/vm/createnetworkhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateNetworkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateNetworkReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateNetworkLogic(r.Context(), svcCtx) - resp, err := l.CreateNetwork(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createnetworksegmentrangehandler.go b/api/internal/handler/vm/createnetworksegmentrangehandler.go deleted file mode 100644 index 47f7e5fa..00000000 --- a/api/internal/handler/vm/createnetworksegmentrangehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateNetworkSegmentRangeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateNetworkSegmentRangeReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateNetworkSegmentRangeLogic(r.Context(), svcCtx) - resp, err := l.CreateNetworkSegmentRange(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createnodehandler.go b/api/internal/handler/vm/createnodehandler.go deleted file mode 100644 index 5df9dd56..00000000 --- a/api/internal/handler/vm/createnodehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateNodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateNodeReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateNodeLogic(r.Context(), svcCtx) - resp, err := l.CreateNode(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createporthandler.go b/api/internal/handler/vm/createporthandler.go deleted file mode 100644 index 0ea408b7..00000000 --- a/api/internal/handler/vm/createporthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreatePortHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreatePortReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreatePortLogic(r.Context(), svcCtx) - resp, err := l.CreatePort(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createrouterhandler.go b/api/internal/handler/vm/createrouterhandler.go deleted file mode 100644 index 45390b39..00000000 --- a/api/internal/handler/vm/createrouterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateRouterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateRouterReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateRouterLogic(r.Context(), svcCtx) - resp, err := l.CreateRouter(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createsecuritygrouphandler.go b/api/internal/handler/vm/createsecuritygrouphandler.go deleted file mode 100644 index 2fcfd935..00000000 --- a/api/internal/handler/vm/createsecuritygrouphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateSecurityGroupReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateSecurityGroupLogic(r.Context(), svcCtx) - resp, err := l.CreateSecurityGroup(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createsecuritygrouprulehandler.go b/api/internal/handler/vm/createsecuritygrouprulehandler.go deleted file mode 100644 index 11ffe7ea..00000000 --- a/api/internal/handler/vm/createsecuritygrouprulehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateSecurityGroupRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateSecurityGroupRuleReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateSecurityGroupRuleLogic(r.Context(), svcCtx) - resp, err := l.CreateSecurityGroupRule(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createserverhandler.go b/api/internal/handler/vm/createserverhandler.go deleted file mode 100644 index 1afd92f1..00000000 --- a/api/internal/handler/vm/createserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateServerLogic(r.Context(), svcCtx) - resp, err := l.CreateServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createsubnethandler.go b/api/internal/handler/vm/createsubnethandler.go deleted file mode 100644 index 931121f3..00000000 --- a/api/internal/handler/vm/createsubnethandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateSubnetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateSubnetReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateSubnetLogic(r.Context(), svcCtx) - resp, err := l.CreateSubnet(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createvolumehandler.go b/api/internal/handler/vm/createvolumehandler.go deleted file mode 100644 index 4e6c56b3..00000000 --- a/api/internal/handler/vm/createvolumehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateVolumeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateVolumeReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateVolumeLogic(r.Context(), svcCtx) - resp, err := l.CreateVolume(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/createvolumetypeshandler.go b/api/internal/handler/vm/createvolumetypeshandler.go deleted file mode 100644 index 955b889f..00000000 --- a/api/internal/handler/vm/createvolumetypeshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func CreateVolumeTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.CreateVolumeTypeReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewCreateVolumeTypesLogic(r.Context(), svcCtx) - resp, err := l.CreateVolumeTypes(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletefirewallgrouphandler.go b/api/internal/handler/vm/deletefirewallgrouphandler.go deleted file mode 100644 index 240f1ceb..00000000 --- a/api/internal/handler/vm/deletefirewallgrouphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteFirewallGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteFirewallGroupReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteFirewallGroupLogic(r.Context(), svcCtx) - resp, err := l.DeleteFirewallGroup(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletefirewallpolicyhandler.go b/api/internal/handler/vm/deletefirewallpolicyhandler.go deleted file mode 100644 index ee0f12fa..00000000 --- a/api/internal/handler/vm/deletefirewallpolicyhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteFirewallPolicyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteFirewallPolicyReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteFirewallPolicyLogic(r.Context(), svcCtx) - resp, err := l.DeleteFirewallPolicy(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletefirewallrulehandler.go b/api/internal/handler/vm/deletefirewallrulehandler.go deleted file mode 100644 index 44c60272..00000000 --- a/api/internal/handler/vm/deletefirewallrulehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteFirewallRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteFirewallRuleReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteFirewallRuleLogic(r.Context(), svcCtx) - resp, err := l.DeleteFirewallRule(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deleteflavorhandler.go b/api/internal/handler/vm/deleteflavorhandler.go deleted file mode 100644 index 7bf5fe04..00000000 --- a/api/internal/handler/vm/deleteflavorhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteFlavorHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteFlavorReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteFlavorLogic(r.Context(), svcCtx) - resp, err := l.DeleteFlavor(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletefloatingiphandler.go b/api/internal/handler/vm/deletefloatingiphandler.go deleted file mode 100644 index 3f7abdf3..00000000 --- a/api/internal/handler/vm/deletefloatingiphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteFloatingIPHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteFloatingIPReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteFloatingIPLogic(r.Context(), svcCtx) - resp, err := l.DeleteFloatingIP(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deleteimagehandler.go b/api/internal/handler/vm/deleteimagehandler.go deleted file mode 100644 index 6ba84ce0..00000000 --- a/api/internal/handler/vm/deleteimagehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteImageReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteImageLogic(r.Context(), svcCtx) - resp, err := l.DeleteImage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletenetworkhandler.go b/api/internal/handler/vm/deletenetworkhandler.go deleted file mode 100644 index 182f3747..00000000 --- a/api/internal/handler/vm/deletenetworkhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteNetworkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteNetworkReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteNetworkLogic(r.Context(), svcCtx) - resp, err := l.DeleteNetwork(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletenetworksegmentrangeshandler.go b/api/internal/handler/vm/deletenetworksegmentrangeshandler.go deleted file mode 100644 index b4cfc237..00000000 --- a/api/internal/handler/vm/deletenetworksegmentrangeshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteNetworkSegmentRangesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteNetworkSegmentRangesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteNetworkSegmentRangesLogic(r.Context(), svcCtx) - resp, err := l.DeleteNetworkSegmentRanges(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletenodehandler.go b/api/internal/handler/vm/deletenodehandler.go deleted file mode 100644 index 19f67962..00000000 --- a/api/internal/handler/vm/deletenodehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteNodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteNodeReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteNodeLogic(r.Context(), svcCtx) - resp, err := l.DeleteNode(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deleteporthandler.go b/api/internal/handler/vm/deleteporthandler.go deleted file mode 100644 index 45d4a17a..00000000 --- a/api/internal/handler/vm/deleteporthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeletePortHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeletePortReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeletePortLogic(r.Context(), svcCtx) - resp, err := l.DeletePort(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deleterouterhandler.go b/api/internal/handler/vm/deleterouterhandler.go deleted file mode 100644 index 0184dbed..00000000 --- a/api/internal/handler/vm/deleterouterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteRouterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteRouterReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteRouterLogic(r.Context(), svcCtx) - resp, err := l.DeleteRouter(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletesecuritygrouphandler.go b/api/internal/handler/vm/deletesecuritygrouphandler.go deleted file mode 100644 index 482ba147..00000000 --- a/api/internal/handler/vm/deletesecuritygrouphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteSecurityGroupReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteSecurityGroupLogic(r.Context(), svcCtx) - resp, err := l.DeleteSecurityGroup(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletesecuritygrouprulehandler.go b/api/internal/handler/vm/deletesecuritygrouprulehandler.go deleted file mode 100644 index 5dcf49cf..00000000 --- a/api/internal/handler/vm/deletesecuritygrouprulehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteSecurityGroupRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteSecurityGroupRuleReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteSecurityGroupRuleLogic(r.Context(), svcCtx) - resp, err := l.DeleteSecurityGroupRule(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deleteserverhandler.go b/api/internal/handler/vm/deleteserverhandler.go deleted file mode 100644 index 412ee0a4..00000000 --- a/api/internal/handler/vm/deleteserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteServerLogic(r.Context(), svcCtx) - resp, err := l.DeleteServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletesubnethandler.go b/api/internal/handler/vm/deletesubnethandler.go deleted file mode 100644 index cb8e0b40..00000000 --- a/api/internal/handler/vm/deletesubnethandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteSubnetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteSubnetReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteSubnetLogic(r.Context(), svcCtx) - resp, err := l.DeleteSubnet(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletevolumehandler.go b/api/internal/handler/vm/deletevolumehandler.go deleted file mode 100644 index d7e91490..00000000 --- a/api/internal/handler/vm/deletevolumehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteVolumeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteVolumeReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteVolumeLogic(r.Context(), svcCtx) - resp, err := l.DeleteVolume(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/deletevolumetypehandler.go b/api/internal/handler/vm/deletevolumetypehandler.go deleted file mode 100644 index 6467de46..00000000 --- a/api/internal/handler/vm/deletevolumetypehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func DeleteVolumeTypeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.DeleteVolumeTypeReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewDeleteVolumeTypeLogic(r.Context(), svcCtx) - resp, err := l.DeleteVolumeType(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/getcomputelimitshandler.go b/api/internal/handler/vm/getcomputelimitshandler.go deleted file mode 100644 index e52d0fb9..00000000 --- a/api/internal/handler/vm/getcomputelimitshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetComputeLimitsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetComputeLimitsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewGetComputeLimitsLogic(r.Context(), svcCtx) - resp, err := l.GetComputeLimits(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/getimagenumhandler.go b/api/internal/handler/vm/getimagenumhandler.go deleted file mode 100644 index ecaf4ea1..00000000 --- a/api/internal/handler/vm/getimagenumhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetImageNumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListImagesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewGetImageNumLogic(r.Context(), svcCtx) - resp, err := l.GetImageNum(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/getnetworknumhandler.go b/api/internal/handler/vm/getnetworknumhandler.go deleted file mode 100644 index d1115cdf..00000000 --- a/api/internal/handler/vm/getnetworknumhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetNetworkNumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListNetworksReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewGetNetworkNumLogic(r.Context(), svcCtx) - resp, err := l.GetNetworkNum(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/getserversdetailedbyidhandler.go b/api/internal/handler/vm/getserversdetailedbyidhandler.go deleted file mode 100644 index 884d5412..00000000 --- a/api/internal/handler/vm/getserversdetailedbyidhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetServersDetailedByIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetServersDetailedByIdReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewGetServersDetailedByIdLogic(r.Context(), svcCtx) - resp, err := l.GetServersDetailedById(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/getvolumedetailedbyidhandler.go b/api/internal/handler/vm/getvolumedetailedbyidhandler.go deleted file mode 100644 index fa08be98..00000000 --- a/api/internal/handler/vm/getvolumedetailedbyidhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetVolumeDetailedByIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetVolumeDetailedByIdReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewGetVolumeDetailedByIdLogic(r.Context(), svcCtx) - resp, err := l.GetVolumeDetailedById(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/getvolumelimitshandler.go b/api/internal/handler/vm/getvolumelimitshandler.go deleted file mode 100644 index 07e9af2d..00000000 --- a/api/internal/handler/vm/getvolumelimitshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func GetVolumeLimitsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.GetVolumeLimitsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewGetVolumeLimitsLogic(r.Context(), svcCtx) - resp, err := l.GetVolumeLimits(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listfirewallgroupshandler.go b/api/internal/handler/vm/listfirewallgroupshandler.go deleted file mode 100644 index 01041333..00000000 --- a/api/internal/handler/vm/listfirewallgroupshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListFirewallGroupsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListFirewallGroupsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListFirewallGroupsLogic(r.Context(), svcCtx) - resp, err := l.ListFirewallGroups(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listfirewallpolicieshandler.go b/api/internal/handler/vm/listfirewallpolicieshandler.go deleted file mode 100644 index 877c2806..00000000 --- a/api/internal/handler/vm/listfirewallpolicieshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListFirewallPoliciesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListFirewallPoliciesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListFirewallPoliciesLogic(r.Context(), svcCtx) - resp, err := l.ListFirewallPolicies(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listfirewallruleshandler.go b/api/internal/handler/vm/listfirewallruleshandler.go deleted file mode 100644 index b630593c..00000000 --- a/api/internal/handler/vm/listfirewallruleshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListFirewallRulesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListFirewallRulesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListFirewallRulesLogic(r.Context(), svcCtx) - resp, err := l.ListFirewallRules(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listflavorsdetailhandler.go b/api/internal/handler/vm/listflavorsdetailhandler.go deleted file mode 100644 index 09362f69..00000000 --- a/api/internal/handler/vm/listflavorsdetailhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListFlavorsDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListFlavorsDetailReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListFlavorsDetailLogic(r.Context(), svcCtx) - resp, err := l.ListFlavorsDetail(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listfloatingipshandler.go b/api/internal/handler/vm/listfloatingipshandler.go deleted file mode 100644 index f723634c..00000000 --- a/api/internal/handler/vm/listfloatingipshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListFloatingIPsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListFloatingIPsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListFloatingIPsLogic(r.Context(), svcCtx) - resp, err := l.ListFloatingIPs(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listimageshandler.go b/api/internal/handler/vm/listimageshandler.go deleted file mode 100644 index cf5844cb..00000000 --- a/api/internal/handler/vm/listimageshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListImagesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListImagesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListImagesLogic(r.Context(), svcCtx) - resp, err := l.ListImages(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listnetworksegmentrangesrangehandler.go b/api/internal/handler/vm/listnetworksegmentrangesrangehandler.go deleted file mode 100644 index 27b3478f..00000000 --- a/api/internal/handler/vm/listnetworksegmentrangesrangehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListNetworkSegmentRangesRangeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListNetworkSegmentRangesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListNetworkSegmentRangesRangeLogic(r.Context(), svcCtx) - resp, err := l.ListNetworkSegmentRangesRange(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listnetworkshandler.go b/api/internal/handler/vm/listnetworkshandler.go deleted file mode 100644 index c7078abf..00000000 --- a/api/internal/handler/vm/listnetworkshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListNetworksHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListNetworksReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListNetworksLogic(r.Context(), svcCtx) - resp, err := l.ListNetworks(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listnodeshandler.go b/api/internal/handler/vm/listnodeshandler.go deleted file mode 100644 index fcc192d2..00000000 --- a/api/internal/handler/vm/listnodeshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListNodesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListNodesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListNodesLogic(r.Context(), svcCtx) - resp, err := l.ListNodes(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listportshandler.go b/api/internal/handler/vm/listportshandler.go deleted file mode 100644 index ac134170..00000000 --- a/api/internal/handler/vm/listportshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListPortsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListPortsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListPortsLogic(r.Context(), svcCtx) - resp, err := l.ListPorts(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listroutershandler.go b/api/internal/handler/vm/listroutershandler.go deleted file mode 100644 index e7b6bc11..00000000 --- a/api/internal/handler/vm/listroutershandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListRoutersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListRoutersReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListRoutersLogic(r.Context(), svcCtx) - resp, err := l.ListRouters(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listsecuritygroupruleshandler.go b/api/internal/handler/vm/listsecuritygroupruleshandler.go deleted file mode 100644 index 2b31f7e8..00000000 --- a/api/internal/handler/vm/listsecuritygroupruleshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListSecurityGroupRulesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListSecurityGroupRulesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListSecurityGroupRulesLogic(r.Context(), svcCtx) - resp, err := l.ListSecurityGroupRules(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listsecuritygroupshandler.go b/api/internal/handler/vm/listsecuritygroupshandler.go deleted file mode 100644 index be559d8d..00000000 --- a/api/internal/handler/vm/listsecuritygroupshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListSecurityGroupsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListSecurityGroupsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListSecurityGroupsLogic(r.Context(), svcCtx) - resp, err := l.ListSecurityGroups(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listserverhandler.go b/api/internal/handler/vm/listserverhandler.go deleted file mode 100644 index 4c859136..00000000 --- a/api/internal/handler/vm/listserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListServersReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListServerLogic(r.Context(), svcCtx) - resp, err := l.ListServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listserversdetailedhandler.go b/api/internal/handler/vm/listserversdetailedhandler.go deleted file mode 100644 index 1dc3daaf..00000000 --- a/api/internal/handler/vm/listserversdetailedhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListServersDetailedHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListServersDetailedReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListServersDetailedLogic(r.Context(), svcCtx) - resp, err := l.ListServersDetailed(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listsubnetshandler.go b/api/internal/handler/vm/listsubnetshandler.go deleted file mode 100644 index a148ccc5..00000000 --- a/api/internal/handler/vm/listsubnetshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListSubnetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListSubnetsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListSubnetsLogic(r.Context(), svcCtx) - resp, err := l.ListSubnets(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listvolumesdetailhandler.go b/api/internal/handler/vm/listvolumesdetailhandler.go deleted file mode 100644 index fd0e6bb2..00000000 --- a/api/internal/handler/vm/listvolumesdetailhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListVolumesDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListVolumesDetailReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListVolumesDetailLogic(r.Context(), svcCtx) - resp, err := l.ListVolumesDetail(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listvolumeshandler.go b/api/internal/handler/vm/listvolumeshandler.go deleted file mode 100644 index 330fc958..00000000 --- a/api/internal/handler/vm/listvolumeshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListVolumesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListVolumesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListVolumesLogic(r.Context(), svcCtx) - resp, err := l.ListVolumes(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/listvolumetypeshandler.go b/api/internal/handler/vm/listvolumetypeshandler.go deleted file mode 100644 index 711a2f75..00000000 --- a/api/internal/handler/vm/listvolumetypeshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ListVolumeTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ListVolumeTypesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewListVolumeTypesLogic(r.Context(), svcCtx) - resp, err := l.ListVolumeTypes(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/migrateserverhandler.go b/api/internal/handler/vm/migrateserverhandler.go deleted file mode 100644 index 2a7dbe82..00000000 --- a/api/internal/handler/vm/migrateserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func MigrateServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.MigrateServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewMigrateServerLogic(r.Context(), svcCtx) - resp, err := l.MigrateServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/pauseserverhandler.go b/api/internal/handler/vm/pauseserverhandler.go deleted file mode 100644 index 610c4193..00000000 --- a/api/internal/handler/vm/pauseserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func PauseServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.PauseServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewPauseServerLogic(r.Context(), svcCtx) - resp, err := l.PauseServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/rebootserverhandler.go b/api/internal/handler/vm/rebootserverhandler.go deleted file mode 100644 index 31da26be..00000000 --- a/api/internal/handler/vm/rebootserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func RebootServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.RebootServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewRebootServerLogic(r.Context(), svcCtx) - resp, err := l.RebootServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/removesecuritygrouphandler.go b/api/internal/handler/vm/removesecuritygrouphandler.go deleted file mode 100644 index 40b21349..00000000 --- a/api/internal/handler/vm/removesecuritygrouphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func RemoveSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.RemoveSecurityGroupReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewRemoveSecurityGroupLogic(r.Context(), svcCtx) - resp, err := l.RemoveSecurityGroup(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/rescueserverhandler.go b/api/internal/handler/vm/rescueserverhandler.go deleted file mode 100644 index 97c18bd2..00000000 --- a/api/internal/handler/vm/rescueserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func RescueServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.RescueServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewRescueServerLogic(r.Context(), svcCtx) - resp, err := l.RescueServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/resizeserverhandler.go b/api/internal/handler/vm/resizeserverhandler.go deleted file mode 100644 index 81d8be1e..00000000 --- a/api/internal/handler/vm/resizeserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ResizeServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ResizeServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewResizeServerLogic(r.Context(), svcCtx) - resp, err := l.ResizeServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/shelveserverhandler.go b/api/internal/handler/vm/shelveserverhandler.go deleted file mode 100644 index 927c78c3..00000000 --- a/api/internal/handler/vm/shelveserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShelveServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShelveServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShelveServerLogic(r.Context(), svcCtx) - resp, err := l.ShelveServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/showfirewallgroupdetailshandler.go b/api/internal/handler/vm/showfirewallgroupdetailshandler.go deleted file mode 100644 index 6e1e07ae..00000000 --- a/api/internal/handler/vm/showfirewallgroupdetailshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowFirewallGroupDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowFirewallGroupDetailsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowFirewallGroupDetailsLogic(r.Context(), svcCtx) - resp, err := l.ShowFirewallGroupDetails(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/showfirewallpolicydetailshandler.go b/api/internal/handler/vm/showfirewallpolicydetailshandler.go deleted file mode 100644 index 1b562893..00000000 --- a/api/internal/handler/vm/showfirewallpolicydetailshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowFirewallPolicyDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowFirewallPolicyDetailsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowFirewallPolicyDetailsLogic(r.Context(), svcCtx) - resp, err := l.ShowFirewallPolicyDetails(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/showfirewallruledetailshandler.go b/api/internal/handler/vm/showfirewallruledetailshandler.go deleted file mode 100644 index b026c434..00000000 --- a/api/internal/handler/vm/showfirewallruledetailshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowFirewallRuleDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowFirewallRuleDetailsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowFirewallRuleDetailsLogic(r.Context(), svcCtx) - resp, err := l.ShowFirewallRuleDetails(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/showfloatingipdetailshandler.go b/api/internal/handler/vm/showfloatingipdetailshandler.go deleted file mode 100644 index 91e09a44..00000000 --- a/api/internal/handler/vm/showfloatingipdetailshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowFloatingIPDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowFloatingIPDetailsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowFloatingIPDetailsLogic(r.Context(), svcCtx) - resp, err := l.ShowFloatingIPDetails(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/shownetworkdetailshandler.go b/api/internal/handler/vm/shownetworkdetailshandler.go deleted file mode 100644 index 113a0e7e..00000000 --- a/api/internal/handler/vm/shownetworkdetailshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowNetworkDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowNetworkDetailsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowNetworkDetailsLogic(r.Context(), svcCtx) - resp, err := l.ShowNetworkDetails(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/shownetworksegmentrangedetailshandler.go b/api/internal/handler/vm/shownetworksegmentrangedetailshandler.go deleted file mode 100644 index 309c7533..00000000 --- a/api/internal/handler/vm/shownetworksegmentrangedetailshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowNetworkSegmentRangeDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowNetworkSegmentRangeDetailsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowNetworkSegmentRangeDetailsLogic(r.Context(), svcCtx) - resp, err := l.ShowNetworkSegmentRangeDetails(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/shownodedetailshandler.go b/api/internal/handler/vm/shownodedetailshandler.go deleted file mode 100644 index 1a025f73..00000000 --- a/api/internal/handler/vm/shownodedetailshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowNodeDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowNodeDetailsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowNodeDetailsLogic(r.Context(), svcCtx) - resp, err := l.ShowNodeDetails(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/showportdetailshandler.go b/api/internal/handler/vm/showportdetailshandler.go deleted file mode 100644 index 2066679e..00000000 --- a/api/internal/handler/vm/showportdetailshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowPortDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowPortDetailsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowPortDetailsLogic(r.Context(), svcCtx) - resp, err := l.ShowPortDetails(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/showrouterdetailshandler.go b/api/internal/handler/vm/showrouterdetailshandler.go deleted file mode 100644 index 395e03d2..00000000 --- a/api/internal/handler/vm/showrouterdetailshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowRouterDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowRouterDetailsReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowRouterDetailsLogic(r.Context(), svcCtx) - resp, err := l.ShowRouterDetails(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/showsecuritygrouphandler.go b/api/internal/handler/vm/showsecuritygrouphandler.go deleted file mode 100644 index 0cf2ecfa..00000000 --- a/api/internal/handler/vm/showsecuritygrouphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowSecurityGroupReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowSecurityGroupLogic(r.Context(), svcCtx) - resp, err := l.ShowSecurityGroup(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/showsecuritygrouprulehandler.go b/api/internal/handler/vm/showsecuritygrouprulehandler.go deleted file mode 100644 index 3dcdc0ed..00000000 --- a/api/internal/handler/vm/showsecuritygrouprulehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func ShowSecurityGroupRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ShowSecurityGroupRuleReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewShowSecurityGroupRuleLogic(r.Context(), svcCtx) - resp, err := l.ShowSecurityGroupRule(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/startserverhandler.go b/api/internal/handler/vm/startserverhandler.go deleted file mode 100644 index 00fc4257..00000000 --- a/api/internal/handler/vm/startserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func StartServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.StartServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewStartServerLogic(r.Context(), svcCtx) - resp, err := l.StartServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/stopserverhandler.go b/api/internal/handler/vm/stopserverhandler.go deleted file mode 100644 index 1941ade0..00000000 --- a/api/internal/handler/vm/stopserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func StopServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.StopServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewStopServerLogic(r.Context(), svcCtx) - resp, err := l.StopServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/suspendserverhandler.go b/api/internal/handler/vm/suspendserverhandler.go deleted file mode 100644 index fd9826e8..00000000 --- a/api/internal/handler/vm/suspendserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func SuspendServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.SuspendServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewSuspendServerLogic(r.Context(), svcCtx) - resp, err := l.SuspendServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/unpauseserverhandler.go b/api/internal/handler/vm/unpauseserverhandler.go deleted file mode 100644 index 3095d1e8..00000000 --- a/api/internal/handler/vm/unpauseserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UnpauseServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UnpauseServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUnpauseServerLogic(r.Context(), svcCtx) - resp, err := l.UnpauseServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/unrescuehandler.go b/api/internal/handler/vm/unrescuehandler.go deleted file mode 100644 index e07adec8..00000000 --- a/api/internal/handler/vm/unrescuehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UnRescueHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UnRescueServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUnRescueLogic(r.Context(), svcCtx) - resp, err := l.UnRescue(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updatefirewallgrouphandler.go b/api/internal/handler/vm/updatefirewallgrouphandler.go deleted file mode 100644 index 1d072d0b..00000000 --- a/api/internal/handler/vm/updatefirewallgrouphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateFirewallGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateFirewallGroupReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdateFirewallGroupLogic(r.Context(), svcCtx) - resp, err := l.UpdateFirewallGroup(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updatefloatingiphandler.go b/api/internal/handler/vm/updatefloatingiphandler.go deleted file mode 100644 index 16493a84..00000000 --- a/api/internal/handler/vm/updatefloatingiphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateFloatingIPHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateFloatingIPReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdateFloatingIPLogic(r.Context(), svcCtx) - resp, err := l.UpdateFloatingIP(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updatenetworkhandler.go b/api/internal/handler/vm/updatenetworkhandler.go deleted file mode 100644 index fc1b3a0c..00000000 --- a/api/internal/handler/vm/updatenetworkhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateNetworkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateNetworkReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdateNetworkLogic(r.Context(), svcCtx) - resp, err := l.UpdateNetwork(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updatenetworksegmentrangeshandler.go b/api/internal/handler/vm/updatenetworksegmentrangeshandler.go deleted file mode 100644 index c91e38eb..00000000 --- a/api/internal/handler/vm/updatenetworksegmentrangeshandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateNetworkSegmentRangesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateNetworkSegmentRangesReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdateNetworkSegmentRangesLogic(r.Context(), svcCtx) - resp, err := l.UpdateNetworkSegmentRanges(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updateporthandler.go b/api/internal/handler/vm/updateporthandler.go deleted file mode 100644 index 37e34376..00000000 --- a/api/internal/handler/vm/updateporthandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdatePortHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdatePortReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdatePortLogic(r.Context(), svcCtx) - resp, err := l.UpdatePort(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updaterouterhandler.go b/api/internal/handler/vm/updaterouterhandler.go deleted file mode 100644 index 262ee32a..00000000 --- a/api/internal/handler/vm/updaterouterhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateRouterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateRouterReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdateRouterLogic(r.Context(), svcCtx) - resp, err := l.UpdateRouter(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updatesecuritygrouphandler.go b/api/internal/handler/vm/updatesecuritygrouphandler.go deleted file mode 100644 index 2d0d5de2..00000000 --- a/api/internal/handler/vm/updatesecuritygrouphandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateSecurityGroupReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdateSecurityGroupLogic(r.Context(), svcCtx) - resp, err := l.UpdateSecurityGroup(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updateserverhandler.go b/api/internal/handler/vm/updateserverhandler.go deleted file mode 100644 index acd162a4..00000000 --- a/api/internal/handler/vm/updateserverhandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateServerReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdateServerLogic(r.Context(), svcCtx) - resp, err := l.UpdateServer(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updatesubnethandler.go b/api/internal/handler/vm/updatesubnethandler.go deleted file mode 100644 index a8093754..00000000 --- a/api/internal/handler/vm/updatesubnethandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateSubnetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateSubnetReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdateSubnetLogic(r.Context(), svcCtx) - resp, err := l.UpdateSubnet(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/updatevolumehandler.go b/api/internal/handler/vm/updatevolumehandler.go deleted file mode 100644 index 80389014..00000000 --- a/api/internal/handler/vm/updatevolumehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UpdateVolumeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UpdateVolumeReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUpdateVolumeLogic(r.Context(), svcCtx) - resp, err := l.UpdateVolume(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/handler/vm/uploadimagehandler.go b/api/internal/handler/vm/uploadimagehandler.go deleted file mode 100644 index 0682d12f..00000000 --- a/api/internal/handler/vm/uploadimagehandler.go +++ /dev/null @@ -1,28 +0,0 @@ -package vm - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" -) - -func UploadImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.UploadOsImageReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := vm.NewUploadImageLogic(r.Context(), svcCtx) - resp, err := l.UploadImage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/api/internal/types/types.go b/api/internal/types/types.go index ccc11455..aeb3d62d 100644 --- a/api/internal/types/types.go +++ b/api/internal/types/types.go @@ -869,10 +869,13 @@ type CommitHpcTaskReq struct { StdErrFile string `json:"stdErrFile,optional"` StdInput string `json:"stdInput,optional"` Environment map[string]string `json:"environment,optional"` + ClusterType string `json:"clusterType,optional"` } type CommitHpcTaskResp struct { - TaskId int64 `json:"taskId"` + TaskId int64 `json:"taskId"` + Code int32 `json:"code"` + Msg string `json:"msg"` } type ListJobReq struct { @@ -2885,7 +2888,7 @@ type Server struct { ImageRef string `json:"imageRef,optional" copier:"ImageRef"` Networks []CreNetwork `json:"networks,optional" copier:"Networks"` BlockDeviceMappingV2 []Block_device_mapping_v2 `json:"block_device_mapping_v2,optional" copier:"BlockDeviceMappingV2"` - MinCount string `json:"min_count,optional" copier:"MinCount"` + MinCount int32 `json:"min_count,optional" copier:"MinCount"` } type CreNetwork struct { From 9c1e7b31e0567d4fa8518de9d48be07cfa161965 Mon Sep 17 00:00:00 2001 From: qiwang <1364512070@qq.com> Date: Mon, 25 Mar 2024 19:41:58 +0800 Subject: [PATCH 11/15] fix:Modify configuration file fields Former-commit-id: 14e2d76333ba307db94037a3814193be538b6590 --- .../handler/adapters/adapterslisthandler.go | 28 + .../handler/adapters/clusterlisthandler.go | 28 + .../handler/adapters/createadapterhandler.go | 28 + .../handler/adapters/createclusterhandler.go | 28 + .../handler/adapters/deleteadapterhandler.go | 28 + .../handler/adapters/deleteclusterhandler.go | 28 + .../handler/adapters/getadapterhandler.go | 28 + .../adapters/getadapterrelationhandler.go | 28 + .../handler/adapters/getclusterhandler.go | 28 + .../handler/adapters/getclustersumhandler.go | 28 + .../handler/adapters/updateadapterhandler.go | 28 + .../handler/adapters/updateclusterhandler.go | 28 + .../handler/ai/createalgorithmhandler.go | 28 + .../handler/ai/createdatasethandler.go | 28 + .../handler/ai/createexporttaskhandler.go | 28 + .../handler/ai/createnotebookhandler.go | 28 + .../handler/ai/createprocessortaskhandler.go | 28 + .../handler/ai/createservicehandler.go | 28 + api/internal/handler/ai/createtaskhandler.go | 28 + .../handler/ai/createtrainingjobhandler.go | 28 + .../ai/createvisualizationjobhandler.go | 28 + .../handler/ai/deletealgorithmhandler.go | 28 + .../handler/ai/deletedatasethandler.go | 28 + .../handler/ai/deleteservicehandler.go | 28 + .../handler/ai/deletetrainingjobhandler.go | 28 + .../ai/getexporttasksofdatasethandler.go | 28 + .../ai/getexporttaskstatusofdatasethandler.go | 28 + .../handler/ai/getlisttrainingjobshandler.go | 28 + .../handler/ai/getnotebookstoragehandler.go | 28 + .../handler/ai/getvisualizationjobhandler.go | 28 + .../handler/ai/listalgorithmshandler.go | 28 + .../handler/ai/listclustershandler.go | 28 + api/internal/handler/ai/listdatasethandler.go | 28 + api/internal/handler/ai/listimporthandler.go | 28 + .../handler/ai/listnotebookhandler.go | 28 + .../handler/ai/listserviceshandler.go | 28 + .../handler/ai/mountnotebookstoragehandler.go | 28 + .../handler/ai/showalgorithmbyuuidhandler.go | 28 + api/internal/handler/ai/showservicehandler.go | 28 + .../handler/ai/startnotebookhandler.go | 28 + .../handler/ai/stopnotebookhandler.go | 28 + api/internal/handler/apps/appdetailhandler.go | 28 + api/internal/handler/apps/applisthandler.go | 28 + api/internal/handler/apps/apppodshandler.go | 28 + .../handler/apps/deleteappbyappnamehandler.go | 28 + .../handler/apps/getappbyappnamehandler.go | 28 + .../handler/apps/pauseappbyappnamehandler.go | 28 + .../apps/restartappbyappnamehandler.go | 28 + .../handler/apps/startappbyappnamehandler.go | 28 + .../handler/apps/updateappbyappnamehandler.go | 28 + .../handler/cloud/cloudlisthandler.go | 21 + .../handler/cloud/controllermetricshandler.go | 28 + .../handler/cloud/deleteclusterhandler.go | 28 + .../handler/cloud/deleteyamlhandler.go | 28 + .../handler/cloud/getclusterlisthandler.go | 28 + .../handler/cloud/noticetenanthandler.go | 21 + .../handler/cloud/registerclusterhandler.go | 28 + .../handler/cloud/updatetenanthandler.go | 28 + .../handler/core/centerresourceshandler.go | 21 + .../handler/core/committaskhandler.go | 28 + .../handler/core/commitvmtaskhandler.go | 28 + .../handler/core/deletetaskhandler.go | 28 + .../core/getcomputilitystatisticshandler.go | 21 + .../handler/core/getcomputingpowerhandler.go | 21 + .../handler/core/getgeneralinfohandler.go | 21 + api/internal/handler/core/getregionhandler.go | 21 + .../core/getresourcepanelconfighandler.go | 21 + api/internal/handler/core/jobtotalhandler.go | 21 + .../handler/core/listcenterhandler.go | 21 + .../handler/core/listclusterhandler.go | 28 + .../handler/core/listdomainresourcehandler.go | 21 + .../handler/core/listregionhandler.go | 21 + api/internal/handler/core/metricshandler.go | 21 + .../handler/core/nodeassetshandler.go | 21 + .../handler/core/participantlisthandler.go | 21 + .../handler/core/pulltaskinfohandler.go | 28 + .../handler/core/pushtaskinfohandler.go | 28 + .../core/putresourcepanelconfighandler.go | 28 + .../handler/core/scheduletaskbyyamlhandler.go | 28 + .../handler/core/syncclusterloadhandler.go | 28 + .../handler/core/taskdetailhandler.go | 28 + api/internal/handler/core/tasklisthandler.go | 28 + .../handler/dictionary/adddicthandler.go | 28 + .../handler/dictionary/adddictitemhandler.go | 28 + .../handler/dictionary/deletedicthandler.go | 28 + .../dictionary/deletedictitemhandler.go | 28 + .../handler/dictionary/editdicthandler.go | 28 + .../handler/dictionary/editdictitemhandler.go | 28 + .../handler/dictionary/getdicthandler.go | 28 + .../handler/dictionary/getdictitemhandler.go | 28 + .../handler/dictionary/listdicthandler.go | 28 + .../dictionary/listdictitembycodehandler.go | 28 + .../handler/dictionary/listdictitemhandler.go | 28 + .../handler/hpc/commithpctaskhandler.go | 28 + .../handler/hpc/listhistoryjobhandler.go | 28 + api/internal/handler/hpc/listjobhandler.go | 28 + .../handler/hpc/queueassetshandler.go | 21 + api/internal/handler/image/chunkhandler.go | 21 + .../handler/image/datasetcheckhandler.go | 28 + .../handler/image/imagelisthandler.go | 21 + .../handler/image/uploaddatasethandler.go | 21 + api/internal/handler/image/uploadhandler.go | 21 + api/internal/handler/routes.go | 1166 +++++++++++++++++ .../schedulegetairesourcetypeshandler.go | 21 + .../schedule/schedulegetaitasktypeshandler.go | 21 + .../schedule/schedulegetdatasetshandler.go | 21 + .../schedule/schedulegetstrategyhandler.go | 21 + .../handler/schedule/schedulesubmithandler.go | 28 + .../storage/dailypowerscreenhandler.go | 28 + .../storage/percentercomputerpowershandler.go | 28 + .../handler/storage/screenstoragehandler.go | 28 + .../storelink/deletelinkimagehandler.go | 28 + .../storelink/deletelinktaskhandler.go | 28 + .../handler/storelink/getaispecshandler.go | 28 + .../storelink/getlinkimagelisthandler.go | 28 + .../handler/storelink/getlinktaskhandler.go | 28 + .../storelink/getparticipantshandler.go | 28 + .../storelink/submitlinktaskhandler.go | 28 + .../storelink/uploadlinkimagehandler.go | 28 + .../vm/addsecuritygrouptoserverhandler.go | 28 + .../handler/vm/bulkcreatenetworkshandler.go | 28 + .../vm/changeadministrativepasswordhandler.go | 28 + .../handler/vm/createfirewallgrouphandler.go | 28 + .../handler/vm/createfirewallpolicyhandler.go | 28 + .../handler/vm/createfirewallrulehandler.go | 28 + .../handler/vm/createflavorhandler.go | 28 + .../handler/vm/createfloatingiphandler.go | 28 + api/internal/handler/vm/createimagehandler.go | 28 + .../handler/vm/createnetworkhandler.go | 28 + .../vm/createnetworksegmentrangehandler.go | 28 + api/internal/handler/vm/createnodehandler.go | 28 + api/internal/handler/vm/createporthandler.go | 28 + .../handler/vm/createrouterhandler.go | 28 + .../handler/vm/createsecuritygrouphandler.go | 28 + .../vm/createsecuritygrouprulehandler.go | 28 + .../handler/vm/createserverhandler.go | 28 + .../handler/vm/createsubnethandler.go | 28 + .../handler/vm/createvolumehandler.go | 28 + .../handler/vm/createvolumetypeshandler.go | 28 + .../handler/vm/deletefirewallgrouphandler.go | 28 + .../handler/vm/deletefirewallpolicyhandler.go | 28 + .../handler/vm/deletefirewallrulehandler.go | 28 + .../handler/vm/deleteflavorhandler.go | 28 + .../handler/vm/deletefloatingiphandler.go | 28 + api/internal/handler/vm/deleteimagehandler.go | 28 + .../handler/vm/deletenetworkhandler.go | 28 + .../vm/deletenetworksegmentrangeshandler.go | 28 + api/internal/handler/vm/deletenodehandler.go | 28 + api/internal/handler/vm/deleteporthandler.go | 28 + .../handler/vm/deleterouterhandler.go | 28 + .../handler/vm/deletesecuritygrouphandler.go | 28 + .../vm/deletesecuritygrouprulehandler.go | 28 + .../handler/vm/deleteserverhandler.go | 28 + .../handler/vm/deletesubnethandler.go | 28 + .../handler/vm/deletevolumehandler.go | 28 + .../handler/vm/deletevolumetypehandler.go | 28 + .../handler/vm/getcomputelimitshandler.go | 28 + api/internal/handler/vm/getimagenumhandler.go | 28 + .../handler/vm/getnetworknumhandler.go | 28 + .../vm/getserversdetailedbyidhandler.go | 28 + .../vm/getvolumedetailedbyidhandler.go | 28 + .../handler/vm/getvolumelimitshandler.go | 28 + .../handler/vm/listfirewallgroupshandler.go | 28 + .../handler/vm/listfirewallpolicieshandler.go | 28 + .../handler/vm/listfirewallruleshandler.go | 28 + .../handler/vm/listflavorsdetailhandler.go | 28 + .../handler/vm/listfloatingipshandler.go | 28 + api/internal/handler/vm/listimageshandler.go | 28 + .../listnetworksegmentrangesrangehandler.go | 28 + .../handler/vm/listnetworkshandler.go | 28 + api/internal/handler/vm/listnodeshandler.go | 28 + api/internal/handler/vm/listportshandler.go | 28 + api/internal/handler/vm/listroutershandler.go | 28 + .../vm/listsecuritygroupruleshandler.go | 28 + .../handler/vm/listsecuritygroupshandler.go | 28 + api/internal/handler/vm/listserverhandler.go | 28 + .../handler/vm/listserversdetailedhandler.go | 28 + api/internal/handler/vm/listsubnetshandler.go | 28 + .../handler/vm/listvolumesdetailhandler.go | 28 + api/internal/handler/vm/listvolumeshandler.go | 28 + .../handler/vm/listvolumetypeshandler.go | 28 + .../handler/vm/migrateserverhandler.go | 28 + api/internal/handler/vm/pauseserverhandler.go | 28 + .../handler/vm/rebootserverhandler.go | 28 + .../handler/vm/removesecuritygrouphandler.go | 28 + .../handler/vm/rescueserverhandler.go | 28 + .../handler/vm/resizeserverhandler.go | 28 + .../handler/vm/shelveserverhandler.go | 28 + .../vm/showfirewallgroupdetailshandler.go | 28 + .../vm/showfirewallpolicydetailshandler.go | 28 + .../vm/showfirewallruledetailshandler.go | 28 + .../vm/showfloatingipdetailshandler.go | 28 + .../handler/vm/shownetworkdetailshandler.go | 28 + .../shownetworksegmentrangedetailshandler.go | 28 + .../handler/vm/shownodedetailshandler.go | 28 + .../handler/vm/showportdetailshandler.go | 28 + .../handler/vm/showrouterdetailshandler.go | 28 + .../handler/vm/showsecuritygrouphandler.go | 28 + .../vm/showsecuritygrouprulehandler.go | 28 + api/internal/handler/vm/startserverhandler.go | 28 + api/internal/handler/vm/stopserverhandler.go | 28 + .../handler/vm/suspendserverhandler.go | 28 + .../handler/vm/unpauseserverhandler.go | 28 + api/internal/handler/vm/unrescuehandler.go | 28 + .../handler/vm/updatefirewallgrouphandler.go | 28 + .../handler/vm/updatefloatingiphandler.go | 28 + .../handler/vm/updatenetworkhandler.go | 28 + .../vm/updatenetworksegmentrangeshandler.go | 28 + api/internal/handler/vm/updateporthandler.go | 28 + .../handler/vm/updaterouterhandler.go | 28 + .../handler/vm/updatesecuritygrouphandler.go | 28 + .../handler/vm/updateserverhandler.go | 28 + .../handler/vm/updatesubnethandler.go | 28 + .../handler/vm/updatevolumehandler.go | 28 + api/internal/handler/vm/uploadimagehandler.go | 28 + 215 files changed, 6990 insertions(+) create mode 100644 api/internal/handler/adapters/adapterslisthandler.go create mode 100644 api/internal/handler/adapters/clusterlisthandler.go create mode 100644 api/internal/handler/adapters/createadapterhandler.go create mode 100644 api/internal/handler/adapters/createclusterhandler.go create mode 100644 api/internal/handler/adapters/deleteadapterhandler.go create mode 100644 api/internal/handler/adapters/deleteclusterhandler.go create mode 100644 api/internal/handler/adapters/getadapterhandler.go create mode 100644 api/internal/handler/adapters/getadapterrelationhandler.go create mode 100644 api/internal/handler/adapters/getclusterhandler.go create mode 100644 api/internal/handler/adapters/getclustersumhandler.go create mode 100644 api/internal/handler/adapters/updateadapterhandler.go create mode 100644 api/internal/handler/adapters/updateclusterhandler.go create mode 100644 api/internal/handler/ai/createalgorithmhandler.go create mode 100644 api/internal/handler/ai/createdatasethandler.go create mode 100644 api/internal/handler/ai/createexporttaskhandler.go create mode 100644 api/internal/handler/ai/createnotebookhandler.go create mode 100644 api/internal/handler/ai/createprocessortaskhandler.go create mode 100644 api/internal/handler/ai/createservicehandler.go create mode 100644 api/internal/handler/ai/createtaskhandler.go create mode 100644 api/internal/handler/ai/createtrainingjobhandler.go create mode 100644 api/internal/handler/ai/createvisualizationjobhandler.go create mode 100644 api/internal/handler/ai/deletealgorithmhandler.go create mode 100644 api/internal/handler/ai/deletedatasethandler.go create mode 100644 api/internal/handler/ai/deleteservicehandler.go create mode 100644 api/internal/handler/ai/deletetrainingjobhandler.go create mode 100644 api/internal/handler/ai/getexporttasksofdatasethandler.go create mode 100644 api/internal/handler/ai/getexporttaskstatusofdatasethandler.go create mode 100644 api/internal/handler/ai/getlisttrainingjobshandler.go create mode 100644 api/internal/handler/ai/getnotebookstoragehandler.go create mode 100644 api/internal/handler/ai/getvisualizationjobhandler.go create mode 100644 api/internal/handler/ai/listalgorithmshandler.go create mode 100644 api/internal/handler/ai/listclustershandler.go create mode 100644 api/internal/handler/ai/listdatasethandler.go create mode 100644 api/internal/handler/ai/listimporthandler.go create mode 100644 api/internal/handler/ai/listnotebookhandler.go create mode 100644 api/internal/handler/ai/listserviceshandler.go create mode 100644 api/internal/handler/ai/mountnotebookstoragehandler.go create mode 100644 api/internal/handler/ai/showalgorithmbyuuidhandler.go create mode 100644 api/internal/handler/ai/showservicehandler.go create mode 100644 api/internal/handler/ai/startnotebookhandler.go create mode 100644 api/internal/handler/ai/stopnotebookhandler.go create mode 100644 api/internal/handler/apps/appdetailhandler.go create mode 100644 api/internal/handler/apps/applisthandler.go create mode 100644 api/internal/handler/apps/apppodshandler.go create mode 100644 api/internal/handler/apps/deleteappbyappnamehandler.go create mode 100644 api/internal/handler/apps/getappbyappnamehandler.go create mode 100644 api/internal/handler/apps/pauseappbyappnamehandler.go create mode 100644 api/internal/handler/apps/restartappbyappnamehandler.go create mode 100644 api/internal/handler/apps/startappbyappnamehandler.go create mode 100644 api/internal/handler/apps/updateappbyappnamehandler.go create mode 100644 api/internal/handler/cloud/cloudlisthandler.go create mode 100644 api/internal/handler/cloud/controllermetricshandler.go create mode 100644 api/internal/handler/cloud/deleteclusterhandler.go create mode 100644 api/internal/handler/cloud/deleteyamlhandler.go create mode 100644 api/internal/handler/cloud/getclusterlisthandler.go create mode 100644 api/internal/handler/cloud/noticetenanthandler.go create mode 100644 api/internal/handler/cloud/registerclusterhandler.go create mode 100644 api/internal/handler/cloud/updatetenanthandler.go create mode 100644 api/internal/handler/core/centerresourceshandler.go create mode 100644 api/internal/handler/core/committaskhandler.go create mode 100644 api/internal/handler/core/commitvmtaskhandler.go create mode 100644 api/internal/handler/core/deletetaskhandler.go create mode 100644 api/internal/handler/core/getcomputilitystatisticshandler.go create mode 100644 api/internal/handler/core/getcomputingpowerhandler.go create mode 100644 api/internal/handler/core/getgeneralinfohandler.go create mode 100644 api/internal/handler/core/getregionhandler.go create mode 100644 api/internal/handler/core/getresourcepanelconfighandler.go create mode 100644 api/internal/handler/core/jobtotalhandler.go create mode 100644 api/internal/handler/core/listcenterhandler.go create mode 100644 api/internal/handler/core/listclusterhandler.go create mode 100644 api/internal/handler/core/listdomainresourcehandler.go create mode 100644 api/internal/handler/core/listregionhandler.go create mode 100644 api/internal/handler/core/metricshandler.go create mode 100644 api/internal/handler/core/nodeassetshandler.go create mode 100644 api/internal/handler/core/participantlisthandler.go create mode 100644 api/internal/handler/core/pulltaskinfohandler.go create mode 100644 api/internal/handler/core/pushtaskinfohandler.go create mode 100644 api/internal/handler/core/putresourcepanelconfighandler.go create mode 100644 api/internal/handler/core/scheduletaskbyyamlhandler.go create mode 100644 api/internal/handler/core/syncclusterloadhandler.go create mode 100644 api/internal/handler/core/taskdetailhandler.go create mode 100644 api/internal/handler/core/tasklisthandler.go create mode 100644 api/internal/handler/dictionary/adddicthandler.go create mode 100644 api/internal/handler/dictionary/adddictitemhandler.go create mode 100644 api/internal/handler/dictionary/deletedicthandler.go create mode 100644 api/internal/handler/dictionary/deletedictitemhandler.go create mode 100644 api/internal/handler/dictionary/editdicthandler.go create mode 100644 api/internal/handler/dictionary/editdictitemhandler.go create mode 100644 api/internal/handler/dictionary/getdicthandler.go create mode 100644 api/internal/handler/dictionary/getdictitemhandler.go create mode 100644 api/internal/handler/dictionary/listdicthandler.go create mode 100644 api/internal/handler/dictionary/listdictitembycodehandler.go create mode 100644 api/internal/handler/dictionary/listdictitemhandler.go create mode 100644 api/internal/handler/hpc/commithpctaskhandler.go create mode 100644 api/internal/handler/hpc/listhistoryjobhandler.go create mode 100644 api/internal/handler/hpc/listjobhandler.go create mode 100644 api/internal/handler/hpc/queueassetshandler.go create mode 100644 api/internal/handler/image/chunkhandler.go create mode 100644 api/internal/handler/image/datasetcheckhandler.go create mode 100644 api/internal/handler/image/imagelisthandler.go create mode 100644 api/internal/handler/image/uploaddatasethandler.go create mode 100644 api/internal/handler/image/uploadhandler.go create mode 100644 api/internal/handler/routes.go create mode 100644 api/internal/handler/schedule/schedulegetairesourcetypeshandler.go create mode 100644 api/internal/handler/schedule/schedulegetaitasktypeshandler.go create mode 100644 api/internal/handler/schedule/schedulegetdatasetshandler.go create mode 100644 api/internal/handler/schedule/schedulegetstrategyhandler.go create mode 100644 api/internal/handler/schedule/schedulesubmithandler.go create mode 100644 api/internal/handler/storage/dailypowerscreenhandler.go create mode 100644 api/internal/handler/storage/percentercomputerpowershandler.go create mode 100644 api/internal/handler/storage/screenstoragehandler.go create mode 100644 api/internal/handler/storelink/deletelinkimagehandler.go create mode 100644 api/internal/handler/storelink/deletelinktaskhandler.go create mode 100644 api/internal/handler/storelink/getaispecshandler.go create mode 100644 api/internal/handler/storelink/getlinkimagelisthandler.go create mode 100644 api/internal/handler/storelink/getlinktaskhandler.go create mode 100644 api/internal/handler/storelink/getparticipantshandler.go create mode 100644 api/internal/handler/storelink/submitlinktaskhandler.go create mode 100644 api/internal/handler/storelink/uploadlinkimagehandler.go create mode 100644 api/internal/handler/vm/addsecuritygrouptoserverhandler.go create mode 100644 api/internal/handler/vm/bulkcreatenetworkshandler.go create mode 100644 api/internal/handler/vm/changeadministrativepasswordhandler.go create mode 100644 api/internal/handler/vm/createfirewallgrouphandler.go create mode 100644 api/internal/handler/vm/createfirewallpolicyhandler.go create mode 100644 api/internal/handler/vm/createfirewallrulehandler.go create mode 100644 api/internal/handler/vm/createflavorhandler.go create mode 100644 api/internal/handler/vm/createfloatingiphandler.go create mode 100644 api/internal/handler/vm/createimagehandler.go create mode 100644 api/internal/handler/vm/createnetworkhandler.go create mode 100644 api/internal/handler/vm/createnetworksegmentrangehandler.go create mode 100644 api/internal/handler/vm/createnodehandler.go create mode 100644 api/internal/handler/vm/createporthandler.go create mode 100644 api/internal/handler/vm/createrouterhandler.go create mode 100644 api/internal/handler/vm/createsecuritygrouphandler.go create mode 100644 api/internal/handler/vm/createsecuritygrouprulehandler.go create mode 100644 api/internal/handler/vm/createserverhandler.go create mode 100644 api/internal/handler/vm/createsubnethandler.go create mode 100644 api/internal/handler/vm/createvolumehandler.go create mode 100644 api/internal/handler/vm/createvolumetypeshandler.go create mode 100644 api/internal/handler/vm/deletefirewallgrouphandler.go create mode 100644 api/internal/handler/vm/deletefirewallpolicyhandler.go create mode 100644 api/internal/handler/vm/deletefirewallrulehandler.go create mode 100644 api/internal/handler/vm/deleteflavorhandler.go create mode 100644 api/internal/handler/vm/deletefloatingiphandler.go create mode 100644 api/internal/handler/vm/deleteimagehandler.go create mode 100644 api/internal/handler/vm/deletenetworkhandler.go create mode 100644 api/internal/handler/vm/deletenetworksegmentrangeshandler.go create mode 100644 api/internal/handler/vm/deletenodehandler.go create mode 100644 api/internal/handler/vm/deleteporthandler.go create mode 100644 api/internal/handler/vm/deleterouterhandler.go create mode 100644 api/internal/handler/vm/deletesecuritygrouphandler.go create mode 100644 api/internal/handler/vm/deletesecuritygrouprulehandler.go create mode 100644 api/internal/handler/vm/deleteserverhandler.go create mode 100644 api/internal/handler/vm/deletesubnethandler.go create mode 100644 api/internal/handler/vm/deletevolumehandler.go create mode 100644 api/internal/handler/vm/deletevolumetypehandler.go create mode 100644 api/internal/handler/vm/getcomputelimitshandler.go create mode 100644 api/internal/handler/vm/getimagenumhandler.go create mode 100644 api/internal/handler/vm/getnetworknumhandler.go create mode 100644 api/internal/handler/vm/getserversdetailedbyidhandler.go create mode 100644 api/internal/handler/vm/getvolumedetailedbyidhandler.go create mode 100644 api/internal/handler/vm/getvolumelimitshandler.go create mode 100644 api/internal/handler/vm/listfirewallgroupshandler.go create mode 100644 api/internal/handler/vm/listfirewallpolicieshandler.go create mode 100644 api/internal/handler/vm/listfirewallruleshandler.go create mode 100644 api/internal/handler/vm/listflavorsdetailhandler.go create mode 100644 api/internal/handler/vm/listfloatingipshandler.go create mode 100644 api/internal/handler/vm/listimageshandler.go create mode 100644 api/internal/handler/vm/listnetworksegmentrangesrangehandler.go create mode 100644 api/internal/handler/vm/listnetworkshandler.go create mode 100644 api/internal/handler/vm/listnodeshandler.go create mode 100644 api/internal/handler/vm/listportshandler.go create mode 100644 api/internal/handler/vm/listroutershandler.go create mode 100644 api/internal/handler/vm/listsecuritygroupruleshandler.go create mode 100644 api/internal/handler/vm/listsecuritygroupshandler.go create mode 100644 api/internal/handler/vm/listserverhandler.go create mode 100644 api/internal/handler/vm/listserversdetailedhandler.go create mode 100644 api/internal/handler/vm/listsubnetshandler.go create mode 100644 api/internal/handler/vm/listvolumesdetailhandler.go create mode 100644 api/internal/handler/vm/listvolumeshandler.go create mode 100644 api/internal/handler/vm/listvolumetypeshandler.go create mode 100644 api/internal/handler/vm/migrateserverhandler.go create mode 100644 api/internal/handler/vm/pauseserverhandler.go create mode 100644 api/internal/handler/vm/rebootserverhandler.go create mode 100644 api/internal/handler/vm/removesecuritygrouphandler.go create mode 100644 api/internal/handler/vm/rescueserverhandler.go create mode 100644 api/internal/handler/vm/resizeserverhandler.go create mode 100644 api/internal/handler/vm/shelveserverhandler.go create mode 100644 api/internal/handler/vm/showfirewallgroupdetailshandler.go create mode 100644 api/internal/handler/vm/showfirewallpolicydetailshandler.go create mode 100644 api/internal/handler/vm/showfirewallruledetailshandler.go create mode 100644 api/internal/handler/vm/showfloatingipdetailshandler.go create mode 100644 api/internal/handler/vm/shownetworkdetailshandler.go create mode 100644 api/internal/handler/vm/shownetworksegmentrangedetailshandler.go create mode 100644 api/internal/handler/vm/shownodedetailshandler.go create mode 100644 api/internal/handler/vm/showportdetailshandler.go create mode 100644 api/internal/handler/vm/showrouterdetailshandler.go create mode 100644 api/internal/handler/vm/showsecuritygrouphandler.go create mode 100644 api/internal/handler/vm/showsecuritygrouprulehandler.go create mode 100644 api/internal/handler/vm/startserverhandler.go create mode 100644 api/internal/handler/vm/stopserverhandler.go create mode 100644 api/internal/handler/vm/suspendserverhandler.go create mode 100644 api/internal/handler/vm/unpauseserverhandler.go create mode 100644 api/internal/handler/vm/unrescuehandler.go create mode 100644 api/internal/handler/vm/updatefirewallgrouphandler.go create mode 100644 api/internal/handler/vm/updatefloatingiphandler.go create mode 100644 api/internal/handler/vm/updatenetworkhandler.go create mode 100644 api/internal/handler/vm/updatenetworksegmentrangeshandler.go create mode 100644 api/internal/handler/vm/updateporthandler.go create mode 100644 api/internal/handler/vm/updaterouterhandler.go create mode 100644 api/internal/handler/vm/updatesecuritygrouphandler.go create mode 100644 api/internal/handler/vm/updateserverhandler.go create mode 100644 api/internal/handler/vm/updatesubnethandler.go create mode 100644 api/internal/handler/vm/updatevolumehandler.go create mode 100644 api/internal/handler/vm/uploadimagehandler.go diff --git a/api/internal/handler/adapters/adapterslisthandler.go b/api/internal/handler/adapters/adapterslisthandler.go new file mode 100644 index 00000000..3d84c0c8 --- /dev/null +++ b/api/internal/handler/adapters/adapterslisthandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func AdaptersListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AdapterQueryReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewAdaptersListLogic(r.Context(), svcCtx) + resp, err := l.AdaptersList(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/clusterlisthandler.go b/api/internal/handler/adapters/clusterlisthandler.go new file mode 100644 index 00000000..f1863304 --- /dev/null +++ b/api/internal/handler/adapters/clusterlisthandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ClusterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ClusterReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewClusterListLogic(r.Context(), svcCtx) + resp, err := l.ClusterList(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/createadapterhandler.go b/api/internal/handler/adapters/createadapterhandler.go new file mode 100644 index 00000000..42b60968 --- /dev/null +++ b/api/internal/handler/adapters/createadapterhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AdapterCreateReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewCreateAdapterLogic(r.Context(), svcCtx) + resp, err := l.CreateAdapter(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/createclusterhandler.go b/api/internal/handler/adapters/createclusterhandler.go new file mode 100644 index 00000000..80eaa0de --- /dev/null +++ b/api/internal/handler/adapters/createclusterhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ClusterCreateReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewCreateClusterLogic(r.Context(), svcCtx) + resp, err := l.CreateCluster(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/deleteadapterhandler.go b/api/internal/handler/adapters/deleteadapterhandler.go new file mode 100644 index 00000000..b2e1c7ca --- /dev/null +++ b/api/internal/handler/adapters/deleteadapterhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AdapterDelReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewDeleteAdapterLogic(r.Context(), svcCtx) + resp, err := l.DeleteAdapter(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/deleteclusterhandler.go b/api/internal/handler/adapters/deleteclusterhandler.go new file mode 100644 index 00000000..62e800f1 --- /dev/null +++ b/api/internal/handler/adapters/deleteclusterhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.FId + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewDeleteClusterLogic(r.Context(), svcCtx) + resp, err := l.DeleteCluster(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/getadapterhandler.go b/api/internal/handler/adapters/getadapterhandler.go new file mode 100644 index 00000000..2e4e189d --- /dev/null +++ b/api/internal/handler/adapters/getadapterhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AdapterDelReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewGetAdapterLogic(r.Context(), svcCtx) + resp, err := l.GetAdapter(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/getadapterrelationhandler.go b/api/internal/handler/adapters/getadapterrelationhandler.go new file mode 100644 index 00000000..13212c35 --- /dev/null +++ b/api/internal/handler/adapters/getadapterrelationhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetAdapterRelationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AdapterRelationQueryReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewGetAdapterRelationLogic(r.Context(), svcCtx) + resp, err := l.GetAdapterRelation(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/getclusterhandler.go b/api/internal/handler/adapters/getclusterhandler.go new file mode 100644 index 00000000..865e861f --- /dev/null +++ b/api/internal/handler/adapters/getclusterhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.FId + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewGetClusterLogic(r.Context(), svcCtx) + resp, err := l.GetCluster(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/getclustersumhandler.go b/api/internal/handler/adapters/getclustersumhandler.go new file mode 100644 index 00000000..18fd747e --- /dev/null +++ b/api/internal/handler/adapters/getclustersumhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetClusterSumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ClusterSumReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewGetClusterSumLogic(r.Context(), svcCtx) + resp, err := l.GetClusterSum(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/updateadapterhandler.go b/api/internal/handler/adapters/updateadapterhandler.go new file mode 100644 index 00000000..3800fc16 --- /dev/null +++ b/api/internal/handler/adapters/updateadapterhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AdapterReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewUpdateAdapterLogic(r.Context(), svcCtx) + resp, err := l.UpdateAdapter(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/adapters/updateclusterhandler.go b/api/internal/handler/adapters/updateclusterhandler.go new file mode 100644 index 00000000..f5405d64 --- /dev/null +++ b/api/internal/handler/adapters/updateclusterhandler.go @@ -0,0 +1,28 @@ +package adapters + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ClusterCreateReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := adapters.NewUpdateClusterLogic(r.Context(), svcCtx) + resp, err := l.UpdateCluster(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/createalgorithmhandler.go b/api/internal/handler/ai/createalgorithmhandler.go new file mode 100644 index 00000000..e0ebcb34 --- /dev/null +++ b/api/internal/handler/ai/createalgorithmhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateAlgorithmReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewCreateAlgorithmLogic(r.Context(), svcCtx) + resp, err := l.CreateAlgorithm(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/createdatasethandler.go b/api/internal/handler/ai/createdatasethandler.go new file mode 100644 index 00000000..57bb2728 --- /dev/null +++ b/api/internal/handler/ai/createdatasethandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateDataSetReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewCreateDataSetLogic(r.Context(), svcCtx) + resp, err := l.CreateDataSet(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/createexporttaskhandler.go b/api/internal/handler/ai/createexporttaskhandler.go new file mode 100644 index 00000000..bcc64381 --- /dev/null +++ b/api/internal/handler/ai/createexporttaskhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateExportTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateExportTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewCreateExportTaskLogic(r.Context(), svcCtx) + resp, err := l.CreateExportTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/createnotebookhandler.go b/api/internal/handler/ai/createnotebookhandler.go new file mode 100644 index 00000000..4bf997fc --- /dev/null +++ b/api/internal/handler/ai/createnotebookhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateNotebookReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewCreateNotebookLogic(r.Context(), svcCtx) + resp, err := l.CreateNotebook(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/createprocessortaskhandler.go b/api/internal/handler/ai/createprocessortaskhandler.go new file mode 100644 index 00000000..b2dc6f55 --- /dev/null +++ b/api/internal/handler/ai/createprocessortaskhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateProcessorTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateProcessorTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewCreateProcessorTaskLogic(r.Context(), svcCtx) + resp, err := l.CreateProcessorTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/createservicehandler.go b/api/internal/handler/ai/createservicehandler.go new file mode 100644 index 00000000..dd8ef32a --- /dev/null +++ b/api/internal/handler/ai/createservicehandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateServiceReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewCreateServiceLogic(r.Context(), svcCtx) + resp, err := l.CreateService(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/createtaskhandler.go b/api/internal/handler/ai/createtaskhandler.go new file mode 100644 index 00000000..c1632e63 --- /dev/null +++ b/api/internal/handler/ai/createtaskhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ImportTaskDataReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewCreateTaskLogic(r.Context(), svcCtx) + resp, err := l.CreateTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/createtrainingjobhandler.go b/api/internal/handler/ai/createtrainingjobhandler.go new file mode 100644 index 00000000..f159bf06 --- /dev/null +++ b/api/internal/handler/ai/createtrainingjobhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateTrainingJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateTrainingJobReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewCreateTrainingJobLogic(r.Context(), svcCtx) + resp, err := l.CreateTrainingJob(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/createvisualizationjobhandler.go b/api/internal/handler/ai/createvisualizationjobhandler.go new file mode 100644 index 00000000..b66ffa7c --- /dev/null +++ b/api/internal/handler/ai/createvisualizationjobhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateVisualizationJobReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewCreateVisualizationJobLogic(r.Context(), svcCtx) + resp, err := l.CreateVisualizationJob(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/deletealgorithmhandler.go b/api/internal/handler/ai/deletealgorithmhandler.go new file mode 100644 index 00000000..57630af0 --- /dev/null +++ b/api/internal/handler/ai/deletealgorithmhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteAlgorithmReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewDeleteAlgorithmLogic(r.Context(), svcCtx) + resp, err := l.DeleteAlgorithm(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/deletedatasethandler.go b/api/internal/handler/ai/deletedatasethandler.go new file mode 100644 index 00000000..84288d1c --- /dev/null +++ b/api/internal/handler/ai/deletedatasethandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteDataSetReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewDeleteDataSetLogic(r.Context(), svcCtx) + resp, err := l.DeleteDataSet(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/deleteservicehandler.go b/api/internal/handler/ai/deleteservicehandler.go new file mode 100644 index 00000000..effb9aad --- /dev/null +++ b/api/internal/handler/ai/deleteservicehandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteServiceReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewDeleteServiceLogic(r.Context(), svcCtx) + resp, err := l.DeleteService(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/deletetrainingjobhandler.go b/api/internal/handler/ai/deletetrainingjobhandler.go new file mode 100644 index 00000000..d0666ef7 --- /dev/null +++ b/api/internal/handler/ai/deletetrainingjobhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteTrainingJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteTrainingJobReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewDeleteTrainingJobLogic(r.Context(), svcCtx) + resp, err := l.DeleteTrainingJob(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/getexporttasksofdatasethandler.go b/api/internal/handler/ai/getexporttasksofdatasethandler.go new file mode 100644 index 00000000..bf45832a --- /dev/null +++ b/api/internal/handler/ai/getexporttasksofdatasethandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetExportTasksOfDatasetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetExportTasksOfDatasetReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewGetExportTasksOfDatasetLogic(r.Context(), svcCtx) + resp, err := l.GetExportTasksOfDataset(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go b/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go new file mode 100644 index 00000000..3a7c0337 --- /dev/null +++ b/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetExportTaskStatusOfDatasetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetExportTaskStatusOfDatasetReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewGetExportTaskStatusOfDatasetLogic(r.Context(), svcCtx) + resp, err := l.GetExportTaskStatusOfDataset(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/getlisttrainingjobshandler.go b/api/internal/handler/ai/getlisttrainingjobshandler.go new file mode 100644 index 00000000..3f978dba --- /dev/null +++ b/api/internal/handler/ai/getlisttrainingjobshandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetListTrainingJobsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListTrainingJobsreq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewGetListTrainingJobsLogic(r.Context(), svcCtx) + resp, err := l.GetListTrainingJobs(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/getnotebookstoragehandler.go b/api/internal/handler/ai/getnotebookstoragehandler.go new file mode 100644 index 00000000..2c7618c8 --- /dev/null +++ b/api/internal/handler/ai/getnotebookstoragehandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetNotebookStorageReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewGetNotebookStorageLogic(r.Context(), svcCtx) + resp, err := l.GetNotebookStorage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/getvisualizationjobhandler.go b/api/internal/handler/ai/getvisualizationjobhandler.go new file mode 100644 index 00000000..51f41ed1 --- /dev/null +++ b/api/internal/handler/ai/getvisualizationjobhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetVisualizationJobReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewGetVisualizationJobLogic(r.Context(), svcCtx) + resp, err := l.GetVisualizationJob(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/listalgorithmshandler.go b/api/internal/handler/ai/listalgorithmshandler.go new file mode 100644 index 00000000..56c2ded7 --- /dev/null +++ b/api/internal/handler/ai/listalgorithmshandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListAlgorithmsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListAlgorithmsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewListAlgorithmsLogic(r.Context(), svcCtx) + resp, err := l.ListAlgorithms(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/listclustershandler.go b/api/internal/handler/ai/listclustershandler.go new file mode 100644 index 00000000..50ad73bd --- /dev/null +++ b/api/internal/handler/ai/listclustershandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListClustersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListClustersReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewListClustersLogic(r.Context(), svcCtx) + resp, err := l.ListClusters(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/listdatasethandler.go b/api/internal/handler/ai/listdatasethandler.go new file mode 100644 index 00000000..78f06ffa --- /dev/null +++ b/api/internal/handler/ai/listdatasethandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DataSetReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewListDataSetLogic(r.Context(), svcCtx) + resp, err := l.ListDataSet(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/listimporthandler.go b/api/internal/handler/ai/listimporthandler.go new file mode 100644 index 00000000..32a8c6d0 --- /dev/null +++ b/api/internal/handler/ai/listimporthandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListImportHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListImportTasksReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewListImportLogic(r.Context(), svcCtx) + resp, err := l.ListImport(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/listnotebookhandler.go b/api/internal/handler/ai/listnotebookhandler.go new file mode 100644 index 00000000..b1375aeb --- /dev/null +++ b/api/internal/handler/ai/listnotebookhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListNotebookReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewListNotebookLogic(r.Context(), svcCtx) + resp, err := l.ListNotebook(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/listserviceshandler.go b/api/internal/handler/ai/listserviceshandler.go new file mode 100644 index 00000000..df823191 --- /dev/null +++ b/api/internal/handler/ai/listserviceshandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListServicesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListServicesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewListServicesLogic(r.Context(), svcCtx) + resp, err := l.ListServices(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/mountnotebookstoragehandler.go b/api/internal/handler/ai/mountnotebookstoragehandler.go new file mode 100644 index 00000000..324c9708 --- /dev/null +++ b/api/internal/handler/ai/mountnotebookstoragehandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func MountNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.MountNotebookStorageReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewMountNotebookStorageLogic(r.Context(), svcCtx) + resp, err := l.MountNotebookStorage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/showalgorithmbyuuidhandler.go b/api/internal/handler/ai/showalgorithmbyuuidhandler.go new file mode 100644 index 00000000..a2951560 --- /dev/null +++ b/api/internal/handler/ai/showalgorithmbyuuidhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowAlgorithmByUuidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowAlgorithmByUuidReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewShowAlgorithmByUuidLogic(r.Context(), svcCtx) + resp, err := l.ShowAlgorithmByUuid(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/showservicehandler.go b/api/internal/handler/ai/showservicehandler.go new file mode 100644 index 00000000..d6a9f4b4 --- /dev/null +++ b/api/internal/handler/ai/showservicehandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowServiceReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewShowServiceLogic(r.Context(), svcCtx) + resp, err := l.ShowService(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/startnotebookhandler.go b/api/internal/handler/ai/startnotebookhandler.go new file mode 100644 index 00000000..1416d911 --- /dev/null +++ b/api/internal/handler/ai/startnotebookhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func StartNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.StartNotebookReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewStartNotebookLogic(r.Context(), svcCtx) + resp, err := l.StartNotebook(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/ai/stopnotebookhandler.go b/api/internal/handler/ai/stopnotebookhandler.go new file mode 100644 index 00000000..b6fd7cce --- /dev/null +++ b/api/internal/handler/ai/stopnotebookhandler.go @@ -0,0 +1,28 @@ +package ai + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func StopNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.StopNotebookReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := ai.NewStopNotebookLogic(r.Context(), svcCtx) + resp, err := l.StopNotebook(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/apps/appdetailhandler.go b/api/internal/handler/apps/appdetailhandler.go new file mode 100644 index 00000000..d668a226 --- /dev/null +++ b/api/internal/handler/apps/appdetailhandler.go @@ -0,0 +1,28 @@ +package apps + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func AppDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AppDetailReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := apps.NewAppDetailLogic(r.Context(), svcCtx) + resp, err := l.AppDetail(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/apps/applisthandler.go b/api/internal/handler/apps/applisthandler.go new file mode 100644 index 00000000..823cb985 --- /dev/null +++ b/api/internal/handler/apps/applisthandler.go @@ -0,0 +1,28 @@ +package apps + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func AppListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AppListReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := apps.NewAppListLogic(r.Context(), svcCtx) + resp, err := l.AppList(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/apps/apppodshandler.go b/api/internal/handler/apps/apppodshandler.go new file mode 100644 index 00000000..ef3e0466 --- /dev/null +++ b/api/internal/handler/apps/apppodshandler.go @@ -0,0 +1,28 @@ +package apps + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func AppPodsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AppDetailReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := apps.NewAppPodsLogic(r.Context(), svcCtx) + resp, err := l.AppPods(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/apps/deleteappbyappnamehandler.go b/api/internal/handler/apps/deleteappbyappnamehandler.go new file mode 100644 index 00000000..a6c9efa6 --- /dev/null +++ b/api/internal/handler/apps/deleteappbyappnamehandler.go @@ -0,0 +1,28 @@ +package apps + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteAppReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := apps.NewDeleteAppByAppNameLogic(r.Context(), svcCtx) + resp, err := l.DeleteAppByAppName(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/apps/getappbyappnamehandler.go b/api/internal/handler/apps/getappbyappnamehandler.go new file mode 100644 index 00000000..d7dd16c2 --- /dev/null +++ b/api/internal/handler/apps/getappbyappnamehandler.go @@ -0,0 +1,28 @@ +package apps + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AppDetailReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := apps.NewGetAppByAppNameLogic(r.Context(), svcCtx) + resp, err := l.GetAppByAppName(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/apps/pauseappbyappnamehandler.go b/api/internal/handler/apps/pauseappbyappnamehandler.go new file mode 100644 index 00000000..a53de1ab --- /dev/null +++ b/api/internal/handler/apps/pauseappbyappnamehandler.go @@ -0,0 +1,28 @@ +package apps + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func PauseAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteAppReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := apps.NewPauseAppByAppNameLogic(r.Context(), svcCtx) + resp, err := l.PauseAppByAppName(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/apps/restartappbyappnamehandler.go b/api/internal/handler/apps/restartappbyappnamehandler.go new file mode 100644 index 00000000..94b246af --- /dev/null +++ b/api/internal/handler/apps/restartappbyappnamehandler.go @@ -0,0 +1,28 @@ +package apps + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func RestartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteAppReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := apps.NewRestartAppByAppNameLogic(r.Context(), svcCtx) + resp, err := l.RestartAppByAppName(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/apps/startappbyappnamehandler.go b/api/internal/handler/apps/startappbyappnamehandler.go new file mode 100644 index 00000000..02b6a98b --- /dev/null +++ b/api/internal/handler/apps/startappbyappnamehandler.go @@ -0,0 +1,28 @@ +package apps + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func StartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteAppReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := apps.NewStartAppByAppNameLogic(r.Context(), svcCtx) + resp, err := l.StartAppByAppName(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/apps/updateappbyappnamehandler.go b/api/internal/handler/apps/updateappbyappnamehandler.go new file mode 100644 index 00000000..e72740b8 --- /dev/null +++ b/api/internal/handler/apps/updateappbyappnamehandler.go @@ -0,0 +1,28 @@ +package apps + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteAppReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := apps.NewUpdateAppByAppNameLogic(r.Context(), svcCtx) + resp, err := l.UpdateAppByAppName(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/cloud/cloudlisthandler.go b/api/internal/handler/cloud/cloudlisthandler.go new file mode 100644 index 00000000..22c759c4 --- /dev/null +++ b/api/internal/handler/cloud/cloudlisthandler.go @@ -0,0 +1,21 @@ +package cloud + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func CloudListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := cloud.NewCloudListLogic(r.Context(), svcCtx) + resp, err := l.CloudList() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/cloud/controllermetricshandler.go b/api/internal/handler/cloud/controllermetricshandler.go new file mode 100644 index 00000000..2e02cf43 --- /dev/null +++ b/api/internal/handler/cloud/controllermetricshandler.go @@ -0,0 +1,28 @@ +package cloud + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ControllerMetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ControllerMetricsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := cloud.NewControllerMetricsLogic(r.Context(), svcCtx) + resp, err := l.ControllerMetrics(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/cloud/deleteclusterhandler.go b/api/internal/handler/cloud/deleteclusterhandler.go new file mode 100644 index 00000000..323c25f3 --- /dev/null +++ b/api/internal/handler/cloud/deleteclusterhandler.go @@ -0,0 +1,28 @@ +package cloud + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteClusterReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := cloud.NewDeleteClusterLogic(r.Context(), svcCtx) + resp, err := l.DeleteCluster(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/cloud/deleteyamlhandler.go b/api/internal/handler/cloud/deleteyamlhandler.go new file mode 100644 index 00000000..60a01556 --- /dev/null +++ b/api/internal/handler/cloud/deleteyamlhandler.go @@ -0,0 +1,28 @@ +package cloud + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteYamlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ApplyReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := cloud.NewDeleteYamlLogic(r.Context(), svcCtx) + resp, err := l.DeleteYaml(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/cloud/getclusterlisthandler.go b/api/internal/handler/cloud/getclusterlisthandler.go new file mode 100644 index 00000000..cc04e75d --- /dev/null +++ b/api/internal/handler/cloud/getclusterlisthandler.go @@ -0,0 +1,28 @@ +package cloud + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetClusterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetClusterListReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := cloud.NewGetClusterListLogic(r.Context(), svcCtx) + resp, err := l.GetClusterList(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/cloud/noticetenanthandler.go b/api/internal/handler/cloud/noticetenanthandler.go new file mode 100644 index 00000000..9b3fea29 --- /dev/null +++ b/api/internal/handler/cloud/noticetenanthandler.go @@ -0,0 +1,21 @@ +package cloud + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func NoticeTenantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := cloud.NewNoticeTenantLogic(r.Context(), svcCtx) + resp, err := l.NoticeTenant() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/cloud/registerclusterhandler.go b/api/internal/handler/cloud/registerclusterhandler.go new file mode 100644 index 00000000..f222e5be --- /dev/null +++ b/api/internal/handler/cloud/registerclusterhandler.go @@ -0,0 +1,28 @@ +package cloud + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func RegisterClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.RegisterClusterReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := cloud.NewRegisterClusterLogic(r.Context(), svcCtx) + resp, err := l.RegisterCluster(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/cloud/updatetenanthandler.go b/api/internal/handler/cloud/updatetenanthandler.go new file mode 100644 index 00000000..04b04e32 --- /dev/null +++ b/api/internal/handler/cloud/updatetenanthandler.go @@ -0,0 +1,28 @@ +package cloud + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateTenantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateTenantReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := cloud.NewUpdateTenantLogic(r.Context(), svcCtx) + resp, err := l.UpdateTenant(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/centerresourceshandler.go b/api/internal/handler/core/centerresourceshandler.go new file mode 100644 index 00000000..6c7ae71e --- /dev/null +++ b/api/internal/handler/core/centerresourceshandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func CenterResourcesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewCenterResourcesLogic(r.Context(), svcCtx) + resp, err := l.CenterResources() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/committaskhandler.go b/api/internal/handler/core/committaskhandler.go new file mode 100644 index 00000000..3bea0b93 --- /dev/null +++ b/api/internal/handler/core/committaskhandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CommitTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CommitTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewCommitTaskLogic(r.Context(), svcCtx) + err := l.CommitTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/api/internal/handler/core/commitvmtaskhandler.go b/api/internal/handler/core/commitvmtaskhandler.go new file mode 100644 index 00000000..f2ca9e4b --- /dev/null +++ b/api/internal/handler/core/commitvmtaskhandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CommitVmTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CommitVmTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewCommitVmTaskLogic(r.Context(), svcCtx) + resp, err := l.CommitVmTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/deletetaskhandler.go b/api/internal/handler/core/deletetaskhandler.go new file mode 100644 index 00000000..e5a735e0 --- /dev/null +++ b/api/internal/handler/core/deletetaskhandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewDeleteTaskLogic(r.Context(), svcCtx) + err := l.DeleteTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/api/internal/handler/core/getcomputilitystatisticshandler.go b/api/internal/handler/core/getcomputilitystatisticshandler.go new file mode 100644 index 00000000..8a03ba36 --- /dev/null +++ b/api/internal/handler/core/getcomputilitystatisticshandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func GetComputilityStatisticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewGetComputilityStatisticsLogic(r.Context(), svcCtx) + resp, err := l.GetComputilityStatistics() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/getcomputingpowerhandler.go b/api/internal/handler/core/getcomputingpowerhandler.go new file mode 100644 index 00000000..9e4c77ed --- /dev/null +++ b/api/internal/handler/core/getcomputingpowerhandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func GetComputingPowerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewGetComputingPowerLogic(r.Context(), svcCtx) + resp, err := l.GetComputingPower() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/getgeneralinfohandler.go b/api/internal/handler/core/getgeneralinfohandler.go new file mode 100644 index 00000000..de4dc89f --- /dev/null +++ b/api/internal/handler/core/getgeneralinfohandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func GetGeneralInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewGetGeneralInfoLogic(r.Context(), svcCtx) + resp, err := l.GetGeneralInfo() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/getregionhandler.go b/api/internal/handler/core/getregionhandler.go new file mode 100644 index 00000000..f85e16c7 --- /dev/null +++ b/api/internal/handler/core/getregionhandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func GetRegionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewGetRegionLogic(r.Context(), svcCtx) + resp, err := l.GetRegion() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/getresourcepanelconfighandler.go b/api/internal/handler/core/getresourcepanelconfighandler.go new file mode 100644 index 00000000..45dde0c1 --- /dev/null +++ b/api/internal/handler/core/getresourcepanelconfighandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func GetResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewGetResourcePanelConfigLogic(r.Context(), svcCtx) + resp, err := l.GetResourcePanelConfig() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/jobtotalhandler.go b/api/internal/handler/core/jobtotalhandler.go new file mode 100644 index 00000000..91caa200 --- /dev/null +++ b/api/internal/handler/core/jobtotalhandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func JobTotalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewJobTotalLogic(r.Context(), svcCtx) + resp, err := l.JobTotal() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/listcenterhandler.go b/api/internal/handler/core/listcenterhandler.go new file mode 100644 index 00000000..cf988c03 --- /dev/null +++ b/api/internal/handler/core/listcenterhandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ListCenterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewListCenterLogic(r.Context(), svcCtx) + resp, err := l.ListCenter() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/listclusterhandler.go b/api/internal/handler/core/listclusterhandler.go new file mode 100644 index 00000000..a2077a06 --- /dev/null +++ b/api/internal/handler/core/listclusterhandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListClusterReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewListClusterLogic(r.Context(), svcCtx) + resp, err := l.ListCluster(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/listdomainresourcehandler.go b/api/internal/handler/core/listdomainresourcehandler.go new file mode 100644 index 00000000..911beacf --- /dev/null +++ b/api/internal/handler/core/listdomainresourcehandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ListDomainResourceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewListDomainResourceLogic(r.Context(), svcCtx) + resp, err := l.ListDomainResource() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/listregionhandler.go b/api/internal/handler/core/listregionhandler.go new file mode 100644 index 00000000..c05760a6 --- /dev/null +++ b/api/internal/handler/core/listregionhandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ListRegionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewListRegionLogic(r.Context(), svcCtx) + resp, err := l.ListRegion() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/metricshandler.go b/api/internal/handler/core/metricshandler.go new file mode 100644 index 00000000..5f715b1d --- /dev/null +++ b/api/internal/handler/core/metricshandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func MetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewMetricsLogic(r.Context(), svcCtx) + err := l.Metrics() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/api/internal/handler/core/nodeassetshandler.go b/api/internal/handler/core/nodeassetshandler.go new file mode 100644 index 00000000..f8bd04a4 --- /dev/null +++ b/api/internal/handler/core/nodeassetshandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func NodeAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewNodeAssetsLogic(r.Context(), svcCtx) + resp, err := l.NodeAssets() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/participantlisthandler.go b/api/internal/handler/core/participantlisthandler.go new file mode 100644 index 00000000..1f122e0f --- /dev/null +++ b/api/internal/handler/core/participantlisthandler.go @@ -0,0 +1,21 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ParticipantListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := core.NewParticipantListLogic(r.Context(), svcCtx) + resp, err := l.ParticipantList() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/pulltaskinfohandler.go b/api/internal/handler/core/pulltaskinfohandler.go new file mode 100644 index 00000000..ed98c682 --- /dev/null +++ b/api/internal/handler/core/pulltaskinfohandler.go @@ -0,0 +1,28 @@ +package core + +import ( + clientCore "gitlink.org.cn/JointCloud/pcm-coordinator/api/client" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func PullTaskInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req clientCore.PullTaskInfoReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewPullTaskInfoLogic(r.Context(), svcCtx) + resp, err := l.PullTaskInfo((*clientCore.PullTaskInfoReq)(&req)) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/pushtaskinfohandler.go b/api/internal/handler/core/pushtaskinfohandler.go new file mode 100644 index 00000000..fa7f5e91 --- /dev/null +++ b/api/internal/handler/core/pushtaskinfohandler.go @@ -0,0 +1,28 @@ +package core + +import ( + clientCore "gitlink.org.cn/JointCloud/pcm-coordinator/api/client" + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func PushTaskInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req clientCore.PushTaskInfoReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewPushTaskInfoLogic(r.Context(), svcCtx) + resp, err := l.PushTaskInfo(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/putresourcepanelconfighandler.go b/api/internal/handler/core/putresourcepanelconfighandler.go new file mode 100644 index 00000000..a425f19a --- /dev/null +++ b/api/internal/handler/core/putresourcepanelconfighandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func PutResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ResourcePanelConfigReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewPutResourcePanelConfigLogic(r.Context(), svcCtx) + err := l.PutResourcePanelConfig(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/api/internal/handler/core/scheduletaskbyyamlhandler.go b/api/internal/handler/core/scheduletaskbyyamlhandler.go new file mode 100644 index 00000000..1841a389 --- /dev/null +++ b/api/internal/handler/core/scheduletaskbyyamlhandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ScheduleTaskByYamlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ScheduleTaskByYamlReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewScheduleTaskByYamlLogic(r.Context(), svcCtx) + err := l.ScheduleTaskByYaml(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/api/internal/handler/core/syncclusterloadhandler.go b/api/internal/handler/core/syncclusterloadhandler.go new file mode 100644 index 00000000..ff36e15b --- /dev/null +++ b/api/internal/handler/core/syncclusterloadhandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func SyncClusterLoadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.SyncClusterLoadReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewSyncClusterLoadLogic(r.Context(), svcCtx) + err := l.SyncClusterLoad(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/api/internal/handler/core/taskdetailhandler.go b/api/internal/handler/core/taskdetailhandler.go new file mode 100644 index 00000000..e97f2706 --- /dev/null +++ b/api/internal/handler/core/taskdetailhandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func TaskDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.TaskDetailReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewTaskDetailLogic(r.Context(), svcCtx) + resp, err := l.TaskDetail(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/tasklisthandler.go b/api/internal/handler/core/tasklisthandler.go new file mode 100644 index 00000000..7b239009 --- /dev/null +++ b/api/internal/handler/core/tasklisthandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func TaskListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.TaskListReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewTaskListLogic(r.Context(), svcCtx) + resp, err := l.TaskList(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/adddicthandler.go b/api/internal/handler/dictionary/adddicthandler.go new file mode 100644 index 00000000..9abc0f7a --- /dev/null +++ b/api/internal/handler/dictionary/adddicthandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func AddDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DictEditReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewAddDictLogic(r.Context(), svcCtx) + resp, err := l.AddDict(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/adddictitemhandler.go b/api/internal/handler/dictionary/adddictitemhandler.go new file mode 100644 index 00000000..c1ab2c69 --- /dev/null +++ b/api/internal/handler/dictionary/adddictitemhandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func AddDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DictItemEditReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewAddDictItemLogic(r.Context(), svcCtx) + resp, err := l.AddDictItem(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/deletedicthandler.go b/api/internal/handler/dictionary/deletedicthandler.go new file mode 100644 index 00000000..435f529e --- /dev/null +++ b/api/internal/handler/dictionary/deletedicthandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CId + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewDeleteDictLogic(r.Context(), svcCtx) + resp, err := l.DeleteDict(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/deletedictitemhandler.go b/api/internal/handler/dictionary/deletedictitemhandler.go new file mode 100644 index 00000000..e029202f --- /dev/null +++ b/api/internal/handler/dictionary/deletedictitemhandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CId + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewDeleteDictItemLogic(r.Context(), svcCtx) + resp, err := l.DeleteDictItem(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/editdicthandler.go b/api/internal/handler/dictionary/editdicthandler.go new file mode 100644 index 00000000..b63e41be --- /dev/null +++ b/api/internal/handler/dictionary/editdicthandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func EditDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DictEditReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewEditDictLogic(r.Context(), svcCtx) + resp, err := l.EditDict(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/editdictitemhandler.go b/api/internal/handler/dictionary/editdictitemhandler.go new file mode 100644 index 00000000..f4f2fd6c --- /dev/null +++ b/api/internal/handler/dictionary/editdictitemhandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func EditDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DictItemEditReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewEditDictItemLogic(r.Context(), svcCtx) + resp, err := l.EditDictItem(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/getdicthandler.go b/api/internal/handler/dictionary/getdicthandler.go new file mode 100644 index 00000000..4a958990 --- /dev/null +++ b/api/internal/handler/dictionary/getdicthandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CId + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewGetDictLogic(r.Context(), svcCtx) + resp, err := l.GetDict(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/getdictitemhandler.go b/api/internal/handler/dictionary/getdictitemhandler.go new file mode 100644 index 00000000..60d8ce06 --- /dev/null +++ b/api/internal/handler/dictionary/getdictitemhandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CId + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewGetDictItemLogic(r.Context(), svcCtx) + resp, err := l.GetDictItem(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/listdicthandler.go b/api/internal/handler/dictionary/listdicthandler.go new file mode 100644 index 00000000..5c34a136 --- /dev/null +++ b/api/internal/handler/dictionary/listdicthandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DictReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewListDictLogic(r.Context(), svcCtx) + resp, err := l.ListDict(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/listdictitembycodehandler.go b/api/internal/handler/dictionary/listdictitembycodehandler.go new file mode 100644 index 00000000..98c6feab --- /dev/null +++ b/api/internal/handler/dictionary/listdictitembycodehandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListDictItemByCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DictCodeReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewListDictItemByCodeLogic(r.Context(), svcCtx) + resp, err := l.ListDictItemByCode(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/dictionary/listdictitemhandler.go b/api/internal/handler/dictionary/listdictitemhandler.go new file mode 100644 index 00000000..5607ee04 --- /dev/null +++ b/api/internal/handler/dictionary/listdictitemhandler.go @@ -0,0 +1,28 @@ +package dictionary + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DictItemReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := dictionary.NewListDictItemLogic(r.Context(), svcCtx) + resp, err := l.ListDictItem(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/hpc/commithpctaskhandler.go b/api/internal/handler/hpc/commithpctaskhandler.go new file mode 100644 index 00000000..a2043def --- /dev/null +++ b/api/internal/handler/hpc/commithpctaskhandler.go @@ -0,0 +1,28 @@ +package hpc + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CommitHpcTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CommitHpcTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := hpc.NewCommitHpcTaskLogic(r.Context(), svcCtx) + resp, err := l.CommitHpcTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/hpc/listhistoryjobhandler.go b/api/internal/handler/hpc/listhistoryjobhandler.go new file mode 100644 index 00000000..ec50c854 --- /dev/null +++ b/api/internal/handler/hpc/listhistoryjobhandler.go @@ -0,0 +1,28 @@ +package hpc + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListHistoryJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListHistoryJobReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := hpc.NewListHistoryJobLogic(r.Context(), svcCtx) + resp, err := l.ListHistoryJob(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/hpc/listjobhandler.go b/api/internal/handler/hpc/listjobhandler.go new file mode 100644 index 00000000..c9572a7e --- /dev/null +++ b/api/internal/handler/hpc/listjobhandler.go @@ -0,0 +1,28 @@ +package hpc + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListJobReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := hpc.NewListJobLogic(r.Context(), svcCtx) + resp, err := l.ListJob(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/hpc/queueassetshandler.go b/api/internal/handler/hpc/queueassetshandler.go new file mode 100644 index 00000000..97c0c5d4 --- /dev/null +++ b/api/internal/handler/hpc/queueassetshandler.go @@ -0,0 +1,21 @@ +package hpc + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func QueueAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := hpc.NewQueueAssetsLogic(r.Context(), svcCtx) + resp, err := l.QueueAssets() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/image/chunkhandler.go b/api/internal/handler/image/chunkhandler.go new file mode 100644 index 00000000..87c8b143 --- /dev/null +++ b/api/internal/handler/image/chunkhandler.go @@ -0,0 +1,21 @@ +package image + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ChunkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := image.NewChunkLogic(r.Context(), svcCtx) + err := l.Chunk() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/api/internal/handler/image/datasetcheckhandler.go b/api/internal/handler/image/datasetcheckhandler.go new file mode 100644 index 00000000..b127987b --- /dev/null +++ b/api/internal/handler/image/datasetcheckhandler.go @@ -0,0 +1,28 @@ +package image + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DataSetCheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CheckReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := image.NewDataSetCheckLogic(r.Context(), svcCtx) + resp, err := l.DataSetCheck(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/image/imagelisthandler.go b/api/internal/handler/image/imagelisthandler.go new file mode 100644 index 00000000..cbd14726 --- /dev/null +++ b/api/internal/handler/image/imagelisthandler.go @@ -0,0 +1,21 @@ +package image + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ImageListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := image.NewImageListLogic(r.Context(), svcCtx) + resp, err := l.ImageList() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/image/uploaddatasethandler.go b/api/internal/handler/image/uploaddatasethandler.go new file mode 100644 index 00000000..ffe715c6 --- /dev/null +++ b/api/internal/handler/image/uploaddatasethandler.go @@ -0,0 +1,21 @@ +package image + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func UploadDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := image.NewUploadDataSetLogic(r.Context(), svcCtx) + err := l.UploadDataSet() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/api/internal/handler/image/uploadhandler.go b/api/internal/handler/image/uploadhandler.go new file mode 100644 index 00000000..66cd4592 --- /dev/null +++ b/api/internal/handler/image/uploadhandler.go @@ -0,0 +1,21 @@ +package image + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func UploadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := image.NewUploadLogic(r.Context(), svcCtx) + err := l.Upload() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.Ok(w) + } + } +} diff --git a/api/internal/handler/routes.go b/api/internal/handler/routes.go new file mode 100644 index 00000000..50f31d6c --- /dev/null +++ b/api/internal/handler/routes.go @@ -0,0 +1,1166 @@ +// Code generated by goctl. DO NOT EDIT. +package handler + +import ( + "net/http" + + adapters "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/adapters" + ai "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/ai" + apps "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/apps" + cloud "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/cloud" + core "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/core" + dictionary "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/dictionary" + hpc "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/hpc" + image "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/image" + schedule "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/schedule" + storage "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/storage" + storelink "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/storelink" + vm "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/handler/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + + "github.com/zeromicro/go-zero/rest" +) + +func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodGet, + Path: "/core/participantList", + Handler: core.ParticipantListHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/core/scheduleTaskByYaml", + Handler: core.ScheduleTaskByYamlHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/core/commitTask", + Handler: core.CommitTaskHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/core/commitVmTask", + Handler: core.CommitVmTaskHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/core/deleteTask/:id", + Handler: core.DeleteTaskHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/taskList", + Handler: core.TaskListHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/taskDetail/:taskId", + Handler: core.TaskDetailHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/jobTotal", + Handler: core.JobTotalHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/listCenter", + Handler: core.ListCenterHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/listCluster/:centerId", + Handler: core.ListClusterHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/getRegion", + Handler: core.GetRegionHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/listRegion", + Handler: core.ListRegionHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/getComputingPower", + Handler: core.GetComputingPowerHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/getGeneralInfo", + Handler: core.GetGeneralInfoHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/listDomainResource", + Handler: core.ListDomainResourceHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/getResourcePanelConfigHandler", + Handler: core.GetResourcePanelConfigHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/core/resourcePanelConfigHandler", + Handler: core.PutResourcePanelConfigHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/getComputilityStatistics", + Handler: core.GetComputilityStatisticsHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/assets", + Handler: core.NodeAssetsHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/centerResources", + Handler: core.CenterResourcesHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/core/syncClusterLoad", + Handler: core.SyncClusterLoadHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/metrics", + Handler: core.MetricsHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/pullTaskInfo", + Handler: core.PullTaskInfoHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/core/pushTaskInfo", + Handler: core.PushTaskInfoHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodPost, + Path: "/hpc/commitHpcTask", + Handler: hpc.CommitHpcTaskHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/hpc/listJob", + Handler: hpc.ListJobHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/hpc/listHistoryJob", + Handler: hpc.ListHistoryJobHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/hpc/queueAssets", + Handler: hpc.QueueAssetsHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodGet, + Path: "/task/list", + Handler: cloud.CloudListHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/cloud/DeleteYaml", + Handler: cloud.DeleteYamlHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/cloud/controller/Metrics", + Handler: cloud.ControllerMetricsHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/cloud/registerCluster", + Handler: cloud.RegisterClusterHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/cloud/deleteCluster", + Handler: cloud.DeleteClusterHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/cloud/noticeTenant", + Handler: cloud.NoticeTenantHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/cloud/updateTenant", + Handler: cloud.UpdateTenantHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/core/clusterList", + Handler: cloud.GetClusterListHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodGet, + Path: "/ai/listDataSet/:projectId", + Handler: ai.ListDataSetHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/createDataSet/:projectId", + Handler: ai.CreateDataSetHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/ai/deleteDataSet/:projectId/:datasetId", + Handler: ai.DeleteDataSetHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/CreateTask/:projectId/:datasetId", + Handler: ai.CreateTaskHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/ListImport/:projectId/:datasetId", + Handler: ai.ListImportHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/GetListTrainingJobs/:projectId", + Handler: ai.GetListTrainingJobsHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/ai/DeleteTrainingJob/:projectId/:trainingJobId", + Handler: ai.DeleteTrainingJobHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/CreateAlgorithm/:projectId", + Handler: ai.CreateAlgorithmHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/ListAlgorithms/:projectId", + Handler: ai.ListAlgorithmsHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/ai/DeleteAlgorithm/:projectId/:algorithmId", + Handler: ai.DeleteAlgorithmHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/CreateTrainingJob/:projectId", + Handler: ai.CreateTrainingJobHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/ShowAlgorithmByUuid/:projectId/:algorithmId", + Handler: ai.ShowAlgorithmByUuidHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/CreateExportTask/:projectId/:datasetId", + Handler: ai.CreateExportTaskHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/GetExportTasksOfDataset/:projectId/:datasetId", + Handler: ai.GetExportTasksOfDatasetHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/GetExportTaskStatusOfDataset/:projectId/:resourceId/:taskId", + Handler: ai.GetExportTaskStatusOfDatasetHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/CreateProcessorTask", + Handler: ai.CreateProcessorTaskHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/CreateService/:projectId", + Handler: ai.CreateServiceHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/ListServices/:projectId", + Handler: ai.ListServicesHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/ShowService/:projectId/:serviceId", + Handler: ai.ShowServiceHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/ai/DeleteService/:projectId/:serviceId", + Handler: ai.DeleteServiceHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/ListClusters", + Handler: ai.ListClustersHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/listNotebook", + Handler: ai.ListNotebookHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/createNotebook", + Handler: ai.CreateNotebookHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/startNotebook", + Handler: ai.StartNotebookHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/stopNotebook", + Handler: ai.StopNotebookHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/getNotebookStorage", + Handler: ai.GetNotebookStorageHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/mountNotebookStorage", + Handler: ai.MountNotebookStorageHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/ai/getVisualizationJob", + Handler: ai.GetVisualizationJobHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/ai/CreateVisualizationJob", + Handler: ai.CreateVisualizationJobHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodGet, + Path: "/storage/screenStorage", + Handler: storage.ScreenStorageHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/storage/dailyPowerScreen", + Handler: storage.DailyPowerScreenHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/storage/perCenterComputerPowers", + Handler: storage.PerCenterComputerPowersHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodPost, + Path: "/upload", + Handler: image.UploadHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/chunk", + Handler: image.ChunkHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/image/list", + Handler: image.ImageListHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/dataSet/check/:fileMd5", + Handler: image.DataSetCheckHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/dataSet/upload", + Handler: image.UploadDataSetHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodGet, + Path: "/vm/getComputeLimits", + Handler: vm.GetComputeLimitsHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/getVolumeLimits", + Handler: vm.GetVolumeLimitsHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/getNetworkNum", + Handler: vm.GetNetworkNumHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/getImageNum", + Handler: vm.GetImageNumHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listServer", + Handler: vm.ListServerHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listServersDetailed", + Handler: vm.ListServersDetailedHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteServer", + Handler: vm.DeleteServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createServer", + Handler: vm.CreateServerHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/getServersDetailedById", + Handler: vm.GetServersDetailedByIdHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updateServer", + Handler: vm.UpdateServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/startServer", + Handler: vm.StartServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/stopServer", + Handler: vm.StopServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/rebootServer", + Handler: vm.RebootServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/pauseServer", + Handler: vm.PauseServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/unpauseServer", + Handler: vm.UnpauseServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/resizeServer", + Handler: vm.ResizeServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/migrateServer", + Handler: vm.MigrateServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/shelveServer", + Handler: vm.ShelveServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/changeAdministrativePassword", + Handler: vm.ChangeAdministrativePasswordHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/rescueServer", + Handler: vm.RescueServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/unRescueServer", + Handler: vm.UnRescueHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/suspendServer", + Handler: vm.SuspendServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/addSecurityGroupToServer", + Handler: vm.AddSecurityGroupToServerHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/removeSecurityGroup", + Handler: vm.RemoveSecurityGroupHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createFlavor", + Handler: vm.CreateFlavorHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/deleteFlavor", + Handler: vm.DeleteFlavorHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listImages", + Handler: vm.ListImagesHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteImage", + Handler: vm.DeleteImageHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createImage", + Handler: vm.CreateImageHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/uploadImage", + Handler: vm.UploadImageHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listNetworks", + Handler: vm.ListNetworksHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteNetwork", + Handler: vm.DeleteNetworkHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createNetwork", + Handler: vm.CreateNetworkHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createSubnet", + Handler: vm.CreateSubnetHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showNetworkDetails", + Handler: vm.ShowNetworkDetailsHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updateNetwork", + Handler: vm.UpdateNetworkHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/bulkCreateNetworks", + Handler: vm.BulkCreateNetworksHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listSubnets", + Handler: vm.ListSubnetsHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteSubnet", + Handler: vm.DeleteSubnetHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updateSubnet", + Handler: vm.UpdateSubnetHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listNetworkSegmentRanges", + Handler: vm.ListNetworkSegmentRangesRangeHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createNetworkSegmentRange", + Handler: vm.CreateNetworkSegmentRangeHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteNetworkSegmentRanges", + Handler: vm.DeleteNetworkSegmentRangesHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updateNetworkSegmentRanges", + Handler: vm.UpdateNetworkSegmentRangesHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showNetworkSegmentRangeDetails", + Handler: vm.ShowNetworkSegmentRangeDetailsHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createPort", + Handler: vm.CreatePortHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listPortsReq", + Handler: vm.ListPortsHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deletePort", + Handler: vm.DeletePortHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updatePort", + Handler: vm.UpdatePortHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showPortDetails", + Handler: vm.ShowPortDetailsHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createRouter", + Handler: vm.CreateRouterHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listRouters", + Handler: vm.ListRoutersHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteRouter", + Handler: vm.DeleteRouterHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updateRouter", + Handler: vm.UpdateRouterHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showRouterDetails", + Handler: vm.ShowRouterDetailsHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createFloatingIP", + Handler: vm.CreateFloatingIPHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listFloatingIPs", + Handler: vm.ListFloatingIPsHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteFloatingIP", + Handler: vm.DeleteFloatingIPHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updateFloatingIP", + Handler: vm.UpdateFloatingIPHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showFloatingIPDetails", + Handler: vm.ShowFloatingIPDetailsHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createFirewallGroup", + Handler: vm.CreateFirewallGroupHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listFirewallGroups", + Handler: vm.ListFirewallGroupsHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteFirewallGroup", + Handler: vm.DeleteFirewallGroupHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updateFirewallGroup", + Handler: vm.UpdateFirewallGroupHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showFirewallGroupDetails", + Handler: vm.ShowFirewallGroupDetailsHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createFirewallPolicy", + Handler: vm.CreateFirewallPolicyHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listFirewallPolicies", + Handler: vm.ListFirewallPoliciesHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteFirewallPolicy", + Handler: vm.DeleteFirewallPolicyHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showFirewallRuleDetails", + Handler: vm.ShowFirewallRuleDetailsHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showFirewallPolicyDetails", + Handler: vm.ShowFirewallPolicyDetailsHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createFirewallRule", + Handler: vm.CreateFirewallRuleHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listFirewallRules", + Handler: vm.ListFirewallRulesHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteFirewallRule", + Handler: vm.DeleteFirewallRuleHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createSecurityGroup", + Handler: vm.CreateSecurityGroupHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listSecurityGroups", + Handler: vm.ListSecurityGroupsHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteSecurityGroup", + Handler: vm.DeleteSecurityGroupHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updateSecurityGroup", + Handler: vm.UpdateSecurityGroupHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showSecurityGroup", + Handler: vm.ShowSecurityGroupHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createSecurityGroupRule", + Handler: vm.CreateSecurityGroupRuleHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listSecurityGroupRules", + Handler: vm.ListSecurityGroupRulesHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteSecurityGroupRule", + Handler: vm.DeleteSecurityGroupRuleHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showSecurityGroupRule", + Handler: vm.ShowSecurityGroupRuleHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listVolumesDetail", + Handler: vm.ListVolumesDetailHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteVolume", + Handler: vm.DeleteVolumeHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createVolume", + Handler: vm.CreateVolumeHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listFlavorsDetail", + Handler: vm.ListFlavorsDetailHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listVolumeTypes", + Handler: vm.ListVolumeTypesHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/vm/updateVolume", + Handler: vm.UpdateVolumeHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createVolumeTypes", + Handler: vm.CreateVolumeTypesHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteVolumeType", + Handler: vm.DeleteVolumeTypeHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listVolumes", + Handler: vm.ListVolumesHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/getVolumeDetailedById", + Handler: vm.GetVolumeDetailedByIdHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/listNodes", + Handler: vm.ListNodesHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/vm/createNode", + Handler: vm.CreateNodeHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/vm/deleteNode", + Handler: vm.DeleteNodeHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/vm/showNodeDetails", + Handler: vm.ShowNodeDetailsHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodPost, + Path: "/storelink/uploadImage", + Handler: storelink.UploadLinkImageHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/storelink/getImageList", + Handler: storelink.GetLinkImageListHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/storelink/deleteImage", + Handler: storelink.DeleteLinkImageHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/storelink/submitTask", + Handler: storelink.SubmitLinkTaskHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/storelink/getTask", + Handler: storelink.GetLinkTaskHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/storelink/deleteTask", + Handler: storelink.DeleteLinkTaskHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/storelink/getParticipants", + Handler: storelink.GetParticipantsHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/storelink/getResourceSpecs", + Handler: storelink.GetAISpecsHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodGet, + Path: "/apps/list", + Handler: apps.AppListHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/apps/distribute/:appName", + Handler: apps.AppDetailHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/apps/pods/:appName", + Handler: apps.AppPodsHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/apps/getAppByAppName/:appName", + Handler: apps.GetAppByAppNameHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/apps/deleteApp", + Handler: apps.DeleteAppByAppNameHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/apps/updateApp", + Handler: apps.UpdateAppByAppNameHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/apps/restartApp", + Handler: apps.RestartAppByAppNameHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/apps/pauseApp", + Handler: apps.PauseAppByAppNameHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/apps/startApp", + Handler: apps.StartAppByAppNameHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodGet, + Path: "/adapter/list", + Handler: adapters.AdaptersListHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/adapter/create", + Handler: adapters.CreateAdapterHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/adapter/update", + Handler: adapters.UpdateAdapterHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/adapter/delete", + Handler: adapters.DeleteAdapterHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/adapter/get", + Handler: adapters.GetAdapterHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/adapter/cluster/list", + Handler: adapters.ClusterListHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/adapter/cluster/create", + Handler: adapters.CreateClusterHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/adapter/cluster/update", + Handler: adapters.UpdateClusterHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/adapter/cluster/delete", + Handler: adapters.DeleteClusterHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/adapter/cluster/get", + Handler: adapters.GetClusterHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/adapter/relation", + Handler: adapters.GetAdapterRelationHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/adapter/clusterSum", + Handler: adapters.GetClusterSumHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodGet, + Path: "/schedule/ai/getResourceTypes", + Handler: schedule.ScheduleGetAiResourceTypesHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/schedule/ai/getTaskTypes", + Handler: schedule.ScheduleGetAiTaskTypesHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/schedule/ai/getDatasets", + Handler: schedule.ScheduleGetDatasetsHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/schedule/ai/getStrategies", + Handler: schedule.ScheduleGetStrategyHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/schedule/submit", + Handler: schedule.ScheduleSubmitHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) + + server.AddRoutes( + []rest.Route{ + { + Method: http.MethodGet, + Path: "/dict/:id", + Handler: dictionary.GetDictHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/dicts", + Handler: dictionary.ListDictHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/dict", + Handler: dictionary.AddDictHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/dict", + Handler: dictionary.EditDictHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/dict/:id", + Handler: dictionary.DeleteDictHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/dictItem/:id", + Handler: dictionary.GetDictItemHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/dictItems", + Handler: dictionary.ListDictItemHandler(serverCtx), + }, + { + Method: http.MethodPost, + Path: "/dictItem", + Handler: dictionary.AddDictItemHandler(serverCtx), + }, + { + Method: http.MethodPut, + Path: "/dictItem", + Handler: dictionary.EditDictItemHandler(serverCtx), + }, + { + Method: http.MethodDelete, + Path: "/dictItem/:id", + Handler: dictionary.DeleteDictItemHandler(serverCtx), + }, + { + Method: http.MethodGet, + Path: "/dictItem/code/:dictCode", + Handler: dictionary.ListDictItemByCodeHandler(serverCtx), + }, + }, + rest.WithPrefix("/pcm/v1"), + ) +} diff --git a/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go b/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go new file mode 100644 index 00000000..430786f2 --- /dev/null +++ b/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go @@ -0,0 +1,21 @@ +package schedule + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ScheduleGetAiResourceTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := schedule.NewScheduleGetAiResourceTypesLogic(r.Context(), svcCtx) + resp, err := l.ScheduleGetAiResourceTypes() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/schedule/schedulegetaitasktypeshandler.go b/api/internal/handler/schedule/schedulegetaitasktypeshandler.go new file mode 100644 index 00000000..5be11070 --- /dev/null +++ b/api/internal/handler/schedule/schedulegetaitasktypeshandler.go @@ -0,0 +1,21 @@ +package schedule + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ScheduleGetAiTaskTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := schedule.NewScheduleGetAiTaskTypesLogic(r.Context(), svcCtx) + resp, err := l.ScheduleGetAiTaskTypes() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/schedule/schedulegetdatasetshandler.go b/api/internal/handler/schedule/schedulegetdatasetshandler.go new file mode 100644 index 00000000..da285546 --- /dev/null +++ b/api/internal/handler/schedule/schedulegetdatasetshandler.go @@ -0,0 +1,21 @@ +package schedule + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ScheduleGetDatasetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := schedule.NewScheduleGetDatasetsLogic(r.Context(), svcCtx) + resp, err := l.ScheduleGetDatasets() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/schedule/schedulegetstrategyhandler.go b/api/internal/handler/schedule/schedulegetstrategyhandler.go new file mode 100644 index 00000000..2ee88fba --- /dev/null +++ b/api/internal/handler/schedule/schedulegetstrategyhandler.go @@ -0,0 +1,21 @@ +package schedule + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" +) + +func ScheduleGetStrategyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := schedule.NewScheduleGetStrategyLogic(r.Context(), svcCtx) + resp, err := l.ScheduleGetStrategy() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/schedule/schedulesubmithandler.go b/api/internal/handler/schedule/schedulesubmithandler.go new file mode 100644 index 00000000..a536f649 --- /dev/null +++ b/api/internal/handler/schedule/schedulesubmithandler.go @@ -0,0 +1,28 @@ +package schedule + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ScheduleSubmitHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ScheduleReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := schedule.NewScheduleSubmitLogic(r.Context(), svcCtx) + resp, err := l.ScheduleSubmit(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storage/dailypowerscreenhandler.go b/api/internal/handler/storage/dailypowerscreenhandler.go new file mode 100644 index 00000000..48844f39 --- /dev/null +++ b/api/internal/handler/storage/dailypowerscreenhandler.go @@ -0,0 +1,28 @@ +package storage + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storage" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DailyPowerScreenHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DailyPowerScreenReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storage.NewDailyPowerScreenLogic(r.Context(), svcCtx) + resp, err := l.DailyPowerScreen(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storage/percentercomputerpowershandler.go b/api/internal/handler/storage/percentercomputerpowershandler.go new file mode 100644 index 00000000..2e1b5f78 --- /dev/null +++ b/api/internal/handler/storage/percentercomputerpowershandler.go @@ -0,0 +1,28 @@ +package storage + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storage" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func PerCenterComputerPowersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.PerCenterComputerPowersReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storage.NewPerCenterComputerPowersLogic(r.Context(), svcCtx) + resp, err := l.PerCenterComputerPowers(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storage/screenstoragehandler.go b/api/internal/handler/storage/screenstoragehandler.go new file mode 100644 index 00000000..8a8a2bec --- /dev/null +++ b/api/internal/handler/storage/screenstoragehandler.go @@ -0,0 +1,28 @@ +package storage + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storage" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ScreenStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.StorageScreenReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storage.NewScreenStorageLogic(r.Context(), svcCtx) + resp, err := l.ScreenStorage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storelink/deletelinkimagehandler.go b/api/internal/handler/storelink/deletelinkimagehandler.go new file mode 100644 index 00000000..fc56fe9d --- /dev/null +++ b/api/internal/handler/storelink/deletelinkimagehandler.go @@ -0,0 +1,28 @@ +package storelink + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteLinkImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteLinkImageReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storelink.NewDeleteLinkImageLogic(r.Context(), svcCtx) + resp, err := l.DeleteLinkImage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storelink/deletelinktaskhandler.go b/api/internal/handler/storelink/deletelinktaskhandler.go new file mode 100644 index 00000000..536b3ae9 --- /dev/null +++ b/api/internal/handler/storelink/deletelinktaskhandler.go @@ -0,0 +1,28 @@ +package storelink + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteLinkTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteLinkTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storelink.NewDeleteLinkTaskLogic(r.Context(), svcCtx) + resp, err := l.DeleteLinkTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storelink/getaispecshandler.go b/api/internal/handler/storelink/getaispecshandler.go new file mode 100644 index 00000000..8e97d294 --- /dev/null +++ b/api/internal/handler/storelink/getaispecshandler.go @@ -0,0 +1,28 @@ +package storelink + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetAISpecsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetResourceSpecsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storelink.NewGetAISpecsLogic(r.Context(), svcCtx) + resp, err := l.GetAISpecs(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storelink/getlinkimagelisthandler.go b/api/internal/handler/storelink/getlinkimagelisthandler.go new file mode 100644 index 00000000..b83198f6 --- /dev/null +++ b/api/internal/handler/storelink/getlinkimagelisthandler.go @@ -0,0 +1,28 @@ +package storelink + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetLinkImageListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetLinkImageListReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storelink.NewGetLinkImageListLogic(r.Context(), svcCtx) + resp, err := l.GetLinkImageList(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storelink/getlinktaskhandler.go b/api/internal/handler/storelink/getlinktaskhandler.go new file mode 100644 index 00000000..af477e23 --- /dev/null +++ b/api/internal/handler/storelink/getlinktaskhandler.go @@ -0,0 +1,28 @@ +package storelink + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetLinkTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetLinkTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storelink.NewGetLinkTaskLogic(r.Context(), svcCtx) + resp, err := l.GetLinkTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storelink/getparticipantshandler.go b/api/internal/handler/storelink/getparticipantshandler.go new file mode 100644 index 00000000..07c88f83 --- /dev/null +++ b/api/internal/handler/storelink/getparticipantshandler.go @@ -0,0 +1,28 @@ +package storelink + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetParticipantsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetParticipantsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storelink.NewGetParticipantsLogic(r.Context(), svcCtx) + resp, err := l.GetParticipants(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storelink/submitlinktaskhandler.go b/api/internal/handler/storelink/submitlinktaskhandler.go new file mode 100644 index 00000000..5da13f4b --- /dev/null +++ b/api/internal/handler/storelink/submitlinktaskhandler.go @@ -0,0 +1,28 @@ +package storelink + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func SubmitLinkTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.SubmitLinkTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storelink.NewSubmitLinkTaskLogic(r.Context(), svcCtx) + resp, err := l.SubmitLinkTask(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/storelink/uploadlinkimagehandler.go b/api/internal/handler/storelink/uploadlinkimagehandler.go new file mode 100644 index 00000000..9adec263 --- /dev/null +++ b/api/internal/handler/storelink/uploadlinkimagehandler.go @@ -0,0 +1,28 @@ +package storelink + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storelink" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UploadLinkImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UploadLinkImageReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := storelink.NewUploadLinkImageLogic(r.Context(), svcCtx) + resp, err := l.UploadLinkImage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/addsecuritygrouptoserverhandler.go b/api/internal/handler/vm/addsecuritygrouptoserverhandler.go new file mode 100644 index 00000000..86553cbf --- /dev/null +++ b/api/internal/handler/vm/addsecuritygrouptoserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func AddSecurityGroupToServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AddSecurityGroupToServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewAddSecurityGroupToServerLogic(r.Context(), svcCtx) + resp, err := l.AddSecurityGroupToServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/bulkcreatenetworkshandler.go b/api/internal/handler/vm/bulkcreatenetworkshandler.go new file mode 100644 index 00000000..84cad5c6 --- /dev/null +++ b/api/internal/handler/vm/bulkcreatenetworkshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func BulkCreateNetworksHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.BulkCreateNetworksReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewBulkCreateNetworksLogic(r.Context(), svcCtx) + resp, err := l.BulkCreateNetworks(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/changeadministrativepasswordhandler.go b/api/internal/handler/vm/changeadministrativepasswordhandler.go new file mode 100644 index 00000000..ecf1c6bc --- /dev/null +++ b/api/internal/handler/vm/changeadministrativepasswordhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ChangeAdministrativePasswordHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ChangeAdministrativePasswordReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewChangeAdministrativePasswordLogic(r.Context(), svcCtx) + resp, err := l.ChangeAdministrativePassword(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createfirewallgrouphandler.go b/api/internal/handler/vm/createfirewallgrouphandler.go new file mode 100644 index 00000000..f6f5b3a1 --- /dev/null +++ b/api/internal/handler/vm/createfirewallgrouphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateFirewallGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateFirewallGroupReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateFirewallGroupLogic(r.Context(), svcCtx) + resp, err := l.CreateFirewallGroup(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createfirewallpolicyhandler.go b/api/internal/handler/vm/createfirewallpolicyhandler.go new file mode 100644 index 00000000..77d8d1cf --- /dev/null +++ b/api/internal/handler/vm/createfirewallpolicyhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateFirewallPolicyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateFirewallPolicyReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateFirewallPolicyLogic(r.Context(), svcCtx) + resp, err := l.CreateFirewallPolicy(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createfirewallrulehandler.go b/api/internal/handler/vm/createfirewallrulehandler.go new file mode 100644 index 00000000..3995c08a --- /dev/null +++ b/api/internal/handler/vm/createfirewallrulehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateFirewallRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateFirewallRuleReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateFirewallRuleLogic(r.Context(), svcCtx) + resp, err := l.CreateFirewallRule(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createflavorhandler.go b/api/internal/handler/vm/createflavorhandler.go new file mode 100644 index 00000000..f32dc8f2 --- /dev/null +++ b/api/internal/handler/vm/createflavorhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateFlavorHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateFlavorReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateFlavorLogic(r.Context(), svcCtx) + resp, err := l.CreateFlavor(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createfloatingiphandler.go b/api/internal/handler/vm/createfloatingiphandler.go new file mode 100644 index 00000000..797a4a55 --- /dev/null +++ b/api/internal/handler/vm/createfloatingiphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateFloatingIPHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateFloatingIPReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateFloatingIPLogic(r.Context(), svcCtx) + resp, err := l.CreateFloatingIP(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createimagehandler.go b/api/internal/handler/vm/createimagehandler.go new file mode 100644 index 00000000..5f5e4f81 --- /dev/null +++ b/api/internal/handler/vm/createimagehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateImageReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateImageLogic(r.Context(), svcCtx) + resp, err := l.CreateImage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createnetworkhandler.go b/api/internal/handler/vm/createnetworkhandler.go new file mode 100644 index 00000000..2da207be --- /dev/null +++ b/api/internal/handler/vm/createnetworkhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateNetworkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateNetworkReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateNetworkLogic(r.Context(), svcCtx) + resp, err := l.CreateNetwork(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createnetworksegmentrangehandler.go b/api/internal/handler/vm/createnetworksegmentrangehandler.go new file mode 100644 index 00000000..47f7e5fa --- /dev/null +++ b/api/internal/handler/vm/createnetworksegmentrangehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateNetworkSegmentRangeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateNetworkSegmentRangeReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateNetworkSegmentRangeLogic(r.Context(), svcCtx) + resp, err := l.CreateNetworkSegmentRange(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createnodehandler.go b/api/internal/handler/vm/createnodehandler.go new file mode 100644 index 00000000..5df9dd56 --- /dev/null +++ b/api/internal/handler/vm/createnodehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateNodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateNodeReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateNodeLogic(r.Context(), svcCtx) + resp, err := l.CreateNode(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createporthandler.go b/api/internal/handler/vm/createporthandler.go new file mode 100644 index 00000000..0ea408b7 --- /dev/null +++ b/api/internal/handler/vm/createporthandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreatePortHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreatePortReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreatePortLogic(r.Context(), svcCtx) + resp, err := l.CreatePort(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createrouterhandler.go b/api/internal/handler/vm/createrouterhandler.go new file mode 100644 index 00000000..45390b39 --- /dev/null +++ b/api/internal/handler/vm/createrouterhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateRouterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateRouterReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateRouterLogic(r.Context(), svcCtx) + resp, err := l.CreateRouter(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createsecuritygrouphandler.go b/api/internal/handler/vm/createsecuritygrouphandler.go new file mode 100644 index 00000000..2fcfd935 --- /dev/null +++ b/api/internal/handler/vm/createsecuritygrouphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateSecurityGroupReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateSecurityGroupLogic(r.Context(), svcCtx) + resp, err := l.CreateSecurityGroup(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createsecuritygrouprulehandler.go b/api/internal/handler/vm/createsecuritygrouprulehandler.go new file mode 100644 index 00000000..11ffe7ea --- /dev/null +++ b/api/internal/handler/vm/createsecuritygrouprulehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateSecurityGroupRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateSecurityGroupRuleReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateSecurityGroupRuleLogic(r.Context(), svcCtx) + resp, err := l.CreateSecurityGroupRule(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createserverhandler.go b/api/internal/handler/vm/createserverhandler.go new file mode 100644 index 00000000..1afd92f1 --- /dev/null +++ b/api/internal/handler/vm/createserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateServerLogic(r.Context(), svcCtx) + resp, err := l.CreateServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createsubnethandler.go b/api/internal/handler/vm/createsubnethandler.go new file mode 100644 index 00000000..931121f3 --- /dev/null +++ b/api/internal/handler/vm/createsubnethandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateSubnetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateSubnetReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateSubnetLogic(r.Context(), svcCtx) + resp, err := l.CreateSubnet(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createvolumehandler.go b/api/internal/handler/vm/createvolumehandler.go new file mode 100644 index 00000000..4e6c56b3 --- /dev/null +++ b/api/internal/handler/vm/createvolumehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateVolumeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateVolumeReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateVolumeLogic(r.Context(), svcCtx) + resp, err := l.CreateVolume(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/createvolumetypeshandler.go b/api/internal/handler/vm/createvolumetypeshandler.go new file mode 100644 index 00000000..955b889f --- /dev/null +++ b/api/internal/handler/vm/createvolumetypeshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CreateVolumeTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateVolumeTypeReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewCreateVolumeTypesLogic(r.Context(), svcCtx) + resp, err := l.CreateVolumeTypes(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletefirewallgrouphandler.go b/api/internal/handler/vm/deletefirewallgrouphandler.go new file mode 100644 index 00000000..240f1ceb --- /dev/null +++ b/api/internal/handler/vm/deletefirewallgrouphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteFirewallGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteFirewallGroupReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteFirewallGroupLogic(r.Context(), svcCtx) + resp, err := l.DeleteFirewallGroup(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletefirewallpolicyhandler.go b/api/internal/handler/vm/deletefirewallpolicyhandler.go new file mode 100644 index 00000000..ee0f12fa --- /dev/null +++ b/api/internal/handler/vm/deletefirewallpolicyhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteFirewallPolicyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteFirewallPolicyReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteFirewallPolicyLogic(r.Context(), svcCtx) + resp, err := l.DeleteFirewallPolicy(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletefirewallrulehandler.go b/api/internal/handler/vm/deletefirewallrulehandler.go new file mode 100644 index 00000000..44c60272 --- /dev/null +++ b/api/internal/handler/vm/deletefirewallrulehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteFirewallRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteFirewallRuleReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteFirewallRuleLogic(r.Context(), svcCtx) + resp, err := l.DeleteFirewallRule(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deleteflavorhandler.go b/api/internal/handler/vm/deleteflavorhandler.go new file mode 100644 index 00000000..7bf5fe04 --- /dev/null +++ b/api/internal/handler/vm/deleteflavorhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteFlavorHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteFlavorReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteFlavorLogic(r.Context(), svcCtx) + resp, err := l.DeleteFlavor(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletefloatingiphandler.go b/api/internal/handler/vm/deletefloatingiphandler.go new file mode 100644 index 00000000..3f7abdf3 --- /dev/null +++ b/api/internal/handler/vm/deletefloatingiphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteFloatingIPHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteFloatingIPReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteFloatingIPLogic(r.Context(), svcCtx) + resp, err := l.DeleteFloatingIP(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deleteimagehandler.go b/api/internal/handler/vm/deleteimagehandler.go new file mode 100644 index 00000000..6ba84ce0 --- /dev/null +++ b/api/internal/handler/vm/deleteimagehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteImageReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteImageLogic(r.Context(), svcCtx) + resp, err := l.DeleteImage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletenetworkhandler.go b/api/internal/handler/vm/deletenetworkhandler.go new file mode 100644 index 00000000..182f3747 --- /dev/null +++ b/api/internal/handler/vm/deletenetworkhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteNetworkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteNetworkReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteNetworkLogic(r.Context(), svcCtx) + resp, err := l.DeleteNetwork(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletenetworksegmentrangeshandler.go b/api/internal/handler/vm/deletenetworksegmentrangeshandler.go new file mode 100644 index 00000000..b4cfc237 --- /dev/null +++ b/api/internal/handler/vm/deletenetworksegmentrangeshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteNetworkSegmentRangesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteNetworkSegmentRangesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteNetworkSegmentRangesLogic(r.Context(), svcCtx) + resp, err := l.DeleteNetworkSegmentRanges(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletenodehandler.go b/api/internal/handler/vm/deletenodehandler.go new file mode 100644 index 00000000..19f67962 --- /dev/null +++ b/api/internal/handler/vm/deletenodehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteNodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteNodeReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteNodeLogic(r.Context(), svcCtx) + resp, err := l.DeleteNode(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deleteporthandler.go b/api/internal/handler/vm/deleteporthandler.go new file mode 100644 index 00000000..45d4a17a --- /dev/null +++ b/api/internal/handler/vm/deleteporthandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeletePortHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeletePortReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeletePortLogic(r.Context(), svcCtx) + resp, err := l.DeletePort(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deleterouterhandler.go b/api/internal/handler/vm/deleterouterhandler.go new file mode 100644 index 00000000..0184dbed --- /dev/null +++ b/api/internal/handler/vm/deleterouterhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteRouterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteRouterReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteRouterLogic(r.Context(), svcCtx) + resp, err := l.DeleteRouter(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletesecuritygrouphandler.go b/api/internal/handler/vm/deletesecuritygrouphandler.go new file mode 100644 index 00000000..482ba147 --- /dev/null +++ b/api/internal/handler/vm/deletesecuritygrouphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteSecurityGroupReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteSecurityGroupLogic(r.Context(), svcCtx) + resp, err := l.DeleteSecurityGroup(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletesecuritygrouprulehandler.go b/api/internal/handler/vm/deletesecuritygrouprulehandler.go new file mode 100644 index 00000000..5dcf49cf --- /dev/null +++ b/api/internal/handler/vm/deletesecuritygrouprulehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteSecurityGroupRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteSecurityGroupRuleReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteSecurityGroupRuleLogic(r.Context(), svcCtx) + resp, err := l.DeleteSecurityGroupRule(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deleteserverhandler.go b/api/internal/handler/vm/deleteserverhandler.go new file mode 100644 index 00000000..412ee0a4 --- /dev/null +++ b/api/internal/handler/vm/deleteserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteServerLogic(r.Context(), svcCtx) + resp, err := l.DeleteServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletesubnethandler.go b/api/internal/handler/vm/deletesubnethandler.go new file mode 100644 index 00000000..cb8e0b40 --- /dev/null +++ b/api/internal/handler/vm/deletesubnethandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteSubnetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteSubnetReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteSubnetLogic(r.Context(), svcCtx) + resp, err := l.DeleteSubnet(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletevolumehandler.go b/api/internal/handler/vm/deletevolumehandler.go new file mode 100644 index 00000000..d7e91490 --- /dev/null +++ b/api/internal/handler/vm/deletevolumehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteVolumeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteVolumeReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteVolumeLogic(r.Context(), svcCtx) + resp, err := l.DeleteVolume(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/deletevolumetypehandler.go b/api/internal/handler/vm/deletevolumetypehandler.go new file mode 100644 index 00000000..6467de46 --- /dev/null +++ b/api/internal/handler/vm/deletevolumetypehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func DeleteVolumeTypeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteVolumeTypeReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewDeleteVolumeTypeLogic(r.Context(), svcCtx) + resp, err := l.DeleteVolumeType(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/getcomputelimitshandler.go b/api/internal/handler/vm/getcomputelimitshandler.go new file mode 100644 index 00000000..e52d0fb9 --- /dev/null +++ b/api/internal/handler/vm/getcomputelimitshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetComputeLimitsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetComputeLimitsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewGetComputeLimitsLogic(r.Context(), svcCtx) + resp, err := l.GetComputeLimits(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/getimagenumhandler.go b/api/internal/handler/vm/getimagenumhandler.go new file mode 100644 index 00000000..ecaf4ea1 --- /dev/null +++ b/api/internal/handler/vm/getimagenumhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetImageNumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListImagesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewGetImageNumLogic(r.Context(), svcCtx) + resp, err := l.GetImageNum(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/getnetworknumhandler.go b/api/internal/handler/vm/getnetworknumhandler.go new file mode 100644 index 00000000..d1115cdf --- /dev/null +++ b/api/internal/handler/vm/getnetworknumhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetNetworkNumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListNetworksReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewGetNetworkNumLogic(r.Context(), svcCtx) + resp, err := l.GetNetworkNum(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/getserversdetailedbyidhandler.go b/api/internal/handler/vm/getserversdetailedbyidhandler.go new file mode 100644 index 00000000..884d5412 --- /dev/null +++ b/api/internal/handler/vm/getserversdetailedbyidhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetServersDetailedByIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetServersDetailedByIdReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewGetServersDetailedByIdLogic(r.Context(), svcCtx) + resp, err := l.GetServersDetailedById(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/getvolumedetailedbyidhandler.go b/api/internal/handler/vm/getvolumedetailedbyidhandler.go new file mode 100644 index 00000000..fa08be98 --- /dev/null +++ b/api/internal/handler/vm/getvolumedetailedbyidhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetVolumeDetailedByIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetVolumeDetailedByIdReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewGetVolumeDetailedByIdLogic(r.Context(), svcCtx) + resp, err := l.GetVolumeDetailedById(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/getvolumelimitshandler.go b/api/internal/handler/vm/getvolumelimitshandler.go new file mode 100644 index 00000000..07e9af2d --- /dev/null +++ b/api/internal/handler/vm/getvolumelimitshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func GetVolumeLimitsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetVolumeLimitsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewGetVolumeLimitsLogic(r.Context(), svcCtx) + resp, err := l.GetVolumeLimits(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listfirewallgroupshandler.go b/api/internal/handler/vm/listfirewallgroupshandler.go new file mode 100644 index 00000000..01041333 --- /dev/null +++ b/api/internal/handler/vm/listfirewallgroupshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListFirewallGroupsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListFirewallGroupsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListFirewallGroupsLogic(r.Context(), svcCtx) + resp, err := l.ListFirewallGroups(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listfirewallpolicieshandler.go b/api/internal/handler/vm/listfirewallpolicieshandler.go new file mode 100644 index 00000000..877c2806 --- /dev/null +++ b/api/internal/handler/vm/listfirewallpolicieshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListFirewallPoliciesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListFirewallPoliciesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListFirewallPoliciesLogic(r.Context(), svcCtx) + resp, err := l.ListFirewallPolicies(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listfirewallruleshandler.go b/api/internal/handler/vm/listfirewallruleshandler.go new file mode 100644 index 00000000..b630593c --- /dev/null +++ b/api/internal/handler/vm/listfirewallruleshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListFirewallRulesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListFirewallRulesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListFirewallRulesLogic(r.Context(), svcCtx) + resp, err := l.ListFirewallRules(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listflavorsdetailhandler.go b/api/internal/handler/vm/listflavorsdetailhandler.go new file mode 100644 index 00000000..09362f69 --- /dev/null +++ b/api/internal/handler/vm/listflavorsdetailhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListFlavorsDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListFlavorsDetailReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListFlavorsDetailLogic(r.Context(), svcCtx) + resp, err := l.ListFlavorsDetail(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listfloatingipshandler.go b/api/internal/handler/vm/listfloatingipshandler.go new file mode 100644 index 00000000..f723634c --- /dev/null +++ b/api/internal/handler/vm/listfloatingipshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListFloatingIPsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListFloatingIPsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListFloatingIPsLogic(r.Context(), svcCtx) + resp, err := l.ListFloatingIPs(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listimageshandler.go b/api/internal/handler/vm/listimageshandler.go new file mode 100644 index 00000000..cf5844cb --- /dev/null +++ b/api/internal/handler/vm/listimageshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListImagesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListImagesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListImagesLogic(r.Context(), svcCtx) + resp, err := l.ListImages(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listnetworksegmentrangesrangehandler.go b/api/internal/handler/vm/listnetworksegmentrangesrangehandler.go new file mode 100644 index 00000000..27b3478f --- /dev/null +++ b/api/internal/handler/vm/listnetworksegmentrangesrangehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListNetworkSegmentRangesRangeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListNetworkSegmentRangesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListNetworkSegmentRangesRangeLogic(r.Context(), svcCtx) + resp, err := l.ListNetworkSegmentRangesRange(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listnetworkshandler.go b/api/internal/handler/vm/listnetworkshandler.go new file mode 100644 index 00000000..c7078abf --- /dev/null +++ b/api/internal/handler/vm/listnetworkshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListNetworksHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListNetworksReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListNetworksLogic(r.Context(), svcCtx) + resp, err := l.ListNetworks(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listnodeshandler.go b/api/internal/handler/vm/listnodeshandler.go new file mode 100644 index 00000000..fcc192d2 --- /dev/null +++ b/api/internal/handler/vm/listnodeshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListNodesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListNodesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListNodesLogic(r.Context(), svcCtx) + resp, err := l.ListNodes(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listportshandler.go b/api/internal/handler/vm/listportshandler.go new file mode 100644 index 00000000..ac134170 --- /dev/null +++ b/api/internal/handler/vm/listportshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListPortsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListPortsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListPortsLogic(r.Context(), svcCtx) + resp, err := l.ListPorts(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listroutershandler.go b/api/internal/handler/vm/listroutershandler.go new file mode 100644 index 00000000..e7b6bc11 --- /dev/null +++ b/api/internal/handler/vm/listroutershandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListRoutersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListRoutersReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListRoutersLogic(r.Context(), svcCtx) + resp, err := l.ListRouters(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listsecuritygroupruleshandler.go b/api/internal/handler/vm/listsecuritygroupruleshandler.go new file mode 100644 index 00000000..2b31f7e8 --- /dev/null +++ b/api/internal/handler/vm/listsecuritygroupruleshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListSecurityGroupRulesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListSecurityGroupRulesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListSecurityGroupRulesLogic(r.Context(), svcCtx) + resp, err := l.ListSecurityGroupRules(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listsecuritygroupshandler.go b/api/internal/handler/vm/listsecuritygroupshandler.go new file mode 100644 index 00000000..be559d8d --- /dev/null +++ b/api/internal/handler/vm/listsecuritygroupshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListSecurityGroupsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListSecurityGroupsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListSecurityGroupsLogic(r.Context(), svcCtx) + resp, err := l.ListSecurityGroups(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listserverhandler.go b/api/internal/handler/vm/listserverhandler.go new file mode 100644 index 00000000..4c859136 --- /dev/null +++ b/api/internal/handler/vm/listserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListServersReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListServerLogic(r.Context(), svcCtx) + resp, err := l.ListServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listserversdetailedhandler.go b/api/internal/handler/vm/listserversdetailedhandler.go new file mode 100644 index 00000000..1dc3daaf --- /dev/null +++ b/api/internal/handler/vm/listserversdetailedhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListServersDetailedHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListServersDetailedReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListServersDetailedLogic(r.Context(), svcCtx) + resp, err := l.ListServersDetailed(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listsubnetshandler.go b/api/internal/handler/vm/listsubnetshandler.go new file mode 100644 index 00000000..a148ccc5 --- /dev/null +++ b/api/internal/handler/vm/listsubnetshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListSubnetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListSubnetsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListSubnetsLogic(r.Context(), svcCtx) + resp, err := l.ListSubnets(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listvolumesdetailhandler.go b/api/internal/handler/vm/listvolumesdetailhandler.go new file mode 100644 index 00000000..fd0e6bb2 --- /dev/null +++ b/api/internal/handler/vm/listvolumesdetailhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListVolumesDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListVolumesDetailReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListVolumesDetailLogic(r.Context(), svcCtx) + resp, err := l.ListVolumesDetail(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listvolumeshandler.go b/api/internal/handler/vm/listvolumeshandler.go new file mode 100644 index 00000000..330fc958 --- /dev/null +++ b/api/internal/handler/vm/listvolumeshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListVolumesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListVolumesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListVolumesLogic(r.Context(), svcCtx) + resp, err := l.ListVolumes(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/listvolumetypeshandler.go b/api/internal/handler/vm/listvolumetypeshandler.go new file mode 100644 index 00000000..711a2f75 --- /dev/null +++ b/api/internal/handler/vm/listvolumetypeshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ListVolumeTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListVolumeTypesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewListVolumeTypesLogic(r.Context(), svcCtx) + resp, err := l.ListVolumeTypes(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/migrateserverhandler.go b/api/internal/handler/vm/migrateserverhandler.go new file mode 100644 index 00000000..2a7dbe82 --- /dev/null +++ b/api/internal/handler/vm/migrateserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func MigrateServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.MigrateServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewMigrateServerLogic(r.Context(), svcCtx) + resp, err := l.MigrateServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/pauseserverhandler.go b/api/internal/handler/vm/pauseserverhandler.go new file mode 100644 index 00000000..610c4193 --- /dev/null +++ b/api/internal/handler/vm/pauseserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func PauseServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.PauseServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewPauseServerLogic(r.Context(), svcCtx) + resp, err := l.PauseServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/rebootserverhandler.go b/api/internal/handler/vm/rebootserverhandler.go new file mode 100644 index 00000000..31da26be --- /dev/null +++ b/api/internal/handler/vm/rebootserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func RebootServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.RebootServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewRebootServerLogic(r.Context(), svcCtx) + resp, err := l.RebootServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/removesecuritygrouphandler.go b/api/internal/handler/vm/removesecuritygrouphandler.go new file mode 100644 index 00000000..40b21349 --- /dev/null +++ b/api/internal/handler/vm/removesecuritygrouphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func RemoveSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.RemoveSecurityGroupReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewRemoveSecurityGroupLogic(r.Context(), svcCtx) + resp, err := l.RemoveSecurityGroup(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/rescueserverhandler.go b/api/internal/handler/vm/rescueserverhandler.go new file mode 100644 index 00000000..97c18bd2 --- /dev/null +++ b/api/internal/handler/vm/rescueserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func RescueServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.RescueServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewRescueServerLogic(r.Context(), svcCtx) + resp, err := l.RescueServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/resizeserverhandler.go b/api/internal/handler/vm/resizeserverhandler.go new file mode 100644 index 00000000..81d8be1e --- /dev/null +++ b/api/internal/handler/vm/resizeserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ResizeServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ResizeServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewResizeServerLogic(r.Context(), svcCtx) + resp, err := l.ResizeServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/shelveserverhandler.go b/api/internal/handler/vm/shelveserverhandler.go new file mode 100644 index 00000000..927c78c3 --- /dev/null +++ b/api/internal/handler/vm/shelveserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShelveServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShelveServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShelveServerLogic(r.Context(), svcCtx) + resp, err := l.ShelveServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/showfirewallgroupdetailshandler.go b/api/internal/handler/vm/showfirewallgroupdetailshandler.go new file mode 100644 index 00000000..6e1e07ae --- /dev/null +++ b/api/internal/handler/vm/showfirewallgroupdetailshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowFirewallGroupDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowFirewallGroupDetailsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowFirewallGroupDetailsLogic(r.Context(), svcCtx) + resp, err := l.ShowFirewallGroupDetails(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/showfirewallpolicydetailshandler.go b/api/internal/handler/vm/showfirewallpolicydetailshandler.go new file mode 100644 index 00000000..1b562893 --- /dev/null +++ b/api/internal/handler/vm/showfirewallpolicydetailshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowFirewallPolicyDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowFirewallPolicyDetailsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowFirewallPolicyDetailsLogic(r.Context(), svcCtx) + resp, err := l.ShowFirewallPolicyDetails(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/showfirewallruledetailshandler.go b/api/internal/handler/vm/showfirewallruledetailshandler.go new file mode 100644 index 00000000..b026c434 --- /dev/null +++ b/api/internal/handler/vm/showfirewallruledetailshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowFirewallRuleDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowFirewallRuleDetailsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowFirewallRuleDetailsLogic(r.Context(), svcCtx) + resp, err := l.ShowFirewallRuleDetails(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/showfloatingipdetailshandler.go b/api/internal/handler/vm/showfloatingipdetailshandler.go new file mode 100644 index 00000000..91e09a44 --- /dev/null +++ b/api/internal/handler/vm/showfloatingipdetailshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowFloatingIPDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowFloatingIPDetailsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowFloatingIPDetailsLogic(r.Context(), svcCtx) + resp, err := l.ShowFloatingIPDetails(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/shownetworkdetailshandler.go b/api/internal/handler/vm/shownetworkdetailshandler.go new file mode 100644 index 00000000..113a0e7e --- /dev/null +++ b/api/internal/handler/vm/shownetworkdetailshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowNetworkDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowNetworkDetailsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowNetworkDetailsLogic(r.Context(), svcCtx) + resp, err := l.ShowNetworkDetails(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/shownetworksegmentrangedetailshandler.go b/api/internal/handler/vm/shownetworksegmentrangedetailshandler.go new file mode 100644 index 00000000..309c7533 --- /dev/null +++ b/api/internal/handler/vm/shownetworksegmentrangedetailshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowNetworkSegmentRangeDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowNetworkSegmentRangeDetailsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowNetworkSegmentRangeDetailsLogic(r.Context(), svcCtx) + resp, err := l.ShowNetworkSegmentRangeDetails(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/shownodedetailshandler.go b/api/internal/handler/vm/shownodedetailshandler.go new file mode 100644 index 00000000..1a025f73 --- /dev/null +++ b/api/internal/handler/vm/shownodedetailshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowNodeDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowNodeDetailsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowNodeDetailsLogic(r.Context(), svcCtx) + resp, err := l.ShowNodeDetails(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/showportdetailshandler.go b/api/internal/handler/vm/showportdetailshandler.go new file mode 100644 index 00000000..2066679e --- /dev/null +++ b/api/internal/handler/vm/showportdetailshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowPortDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowPortDetailsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowPortDetailsLogic(r.Context(), svcCtx) + resp, err := l.ShowPortDetails(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/showrouterdetailshandler.go b/api/internal/handler/vm/showrouterdetailshandler.go new file mode 100644 index 00000000..395e03d2 --- /dev/null +++ b/api/internal/handler/vm/showrouterdetailshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowRouterDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowRouterDetailsReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowRouterDetailsLogic(r.Context(), svcCtx) + resp, err := l.ShowRouterDetails(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/showsecuritygrouphandler.go b/api/internal/handler/vm/showsecuritygrouphandler.go new file mode 100644 index 00000000..0cf2ecfa --- /dev/null +++ b/api/internal/handler/vm/showsecuritygrouphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowSecurityGroupReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowSecurityGroupLogic(r.Context(), svcCtx) + resp, err := l.ShowSecurityGroup(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/showsecuritygrouprulehandler.go b/api/internal/handler/vm/showsecuritygrouprulehandler.go new file mode 100644 index 00000000..3dcdc0ed --- /dev/null +++ b/api/internal/handler/vm/showsecuritygrouprulehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func ShowSecurityGroupRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ShowSecurityGroupRuleReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewShowSecurityGroupRuleLogic(r.Context(), svcCtx) + resp, err := l.ShowSecurityGroupRule(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/startserverhandler.go b/api/internal/handler/vm/startserverhandler.go new file mode 100644 index 00000000..00fc4257 --- /dev/null +++ b/api/internal/handler/vm/startserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func StartServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.StartServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewStartServerLogic(r.Context(), svcCtx) + resp, err := l.StartServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/stopserverhandler.go b/api/internal/handler/vm/stopserverhandler.go new file mode 100644 index 00000000..1941ade0 --- /dev/null +++ b/api/internal/handler/vm/stopserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func StopServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.StopServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewStopServerLogic(r.Context(), svcCtx) + resp, err := l.StopServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/suspendserverhandler.go b/api/internal/handler/vm/suspendserverhandler.go new file mode 100644 index 00000000..fd9826e8 --- /dev/null +++ b/api/internal/handler/vm/suspendserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func SuspendServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.SuspendServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewSuspendServerLogic(r.Context(), svcCtx) + resp, err := l.SuspendServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/unpauseserverhandler.go b/api/internal/handler/vm/unpauseserverhandler.go new file mode 100644 index 00000000..3095d1e8 --- /dev/null +++ b/api/internal/handler/vm/unpauseserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UnpauseServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UnpauseServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUnpauseServerLogic(r.Context(), svcCtx) + resp, err := l.UnpauseServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/unrescuehandler.go b/api/internal/handler/vm/unrescuehandler.go new file mode 100644 index 00000000..e07adec8 --- /dev/null +++ b/api/internal/handler/vm/unrescuehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UnRescueHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UnRescueServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUnRescueLogic(r.Context(), svcCtx) + resp, err := l.UnRescue(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updatefirewallgrouphandler.go b/api/internal/handler/vm/updatefirewallgrouphandler.go new file mode 100644 index 00000000..1d072d0b --- /dev/null +++ b/api/internal/handler/vm/updatefirewallgrouphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateFirewallGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateFirewallGroupReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdateFirewallGroupLogic(r.Context(), svcCtx) + resp, err := l.UpdateFirewallGroup(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updatefloatingiphandler.go b/api/internal/handler/vm/updatefloatingiphandler.go new file mode 100644 index 00000000..16493a84 --- /dev/null +++ b/api/internal/handler/vm/updatefloatingiphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateFloatingIPHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateFloatingIPReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdateFloatingIPLogic(r.Context(), svcCtx) + resp, err := l.UpdateFloatingIP(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updatenetworkhandler.go b/api/internal/handler/vm/updatenetworkhandler.go new file mode 100644 index 00000000..fc1b3a0c --- /dev/null +++ b/api/internal/handler/vm/updatenetworkhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateNetworkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateNetworkReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdateNetworkLogic(r.Context(), svcCtx) + resp, err := l.UpdateNetwork(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updatenetworksegmentrangeshandler.go b/api/internal/handler/vm/updatenetworksegmentrangeshandler.go new file mode 100644 index 00000000..c91e38eb --- /dev/null +++ b/api/internal/handler/vm/updatenetworksegmentrangeshandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateNetworkSegmentRangesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateNetworkSegmentRangesReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdateNetworkSegmentRangesLogic(r.Context(), svcCtx) + resp, err := l.UpdateNetworkSegmentRanges(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updateporthandler.go b/api/internal/handler/vm/updateporthandler.go new file mode 100644 index 00000000..37e34376 --- /dev/null +++ b/api/internal/handler/vm/updateporthandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdatePortHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdatePortReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdatePortLogic(r.Context(), svcCtx) + resp, err := l.UpdatePort(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updaterouterhandler.go b/api/internal/handler/vm/updaterouterhandler.go new file mode 100644 index 00000000..262ee32a --- /dev/null +++ b/api/internal/handler/vm/updaterouterhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateRouterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateRouterReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdateRouterLogic(r.Context(), svcCtx) + resp, err := l.UpdateRouter(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updatesecuritygrouphandler.go b/api/internal/handler/vm/updatesecuritygrouphandler.go new file mode 100644 index 00000000..2d0d5de2 --- /dev/null +++ b/api/internal/handler/vm/updatesecuritygrouphandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateSecurityGroupHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateSecurityGroupReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdateSecurityGroupLogic(r.Context(), svcCtx) + resp, err := l.UpdateSecurityGroup(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updateserverhandler.go b/api/internal/handler/vm/updateserverhandler.go new file mode 100644 index 00000000..acd162a4 --- /dev/null +++ b/api/internal/handler/vm/updateserverhandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateServerReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdateServerLogic(r.Context(), svcCtx) + resp, err := l.UpdateServer(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updatesubnethandler.go b/api/internal/handler/vm/updatesubnethandler.go new file mode 100644 index 00000000..a8093754 --- /dev/null +++ b/api/internal/handler/vm/updatesubnethandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateSubnetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateSubnetReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdateSubnetLogic(r.Context(), svcCtx) + resp, err := l.UpdateSubnet(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/updatevolumehandler.go b/api/internal/handler/vm/updatevolumehandler.go new file mode 100644 index 00000000..80389014 --- /dev/null +++ b/api/internal/handler/vm/updatevolumehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UpdateVolumeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateVolumeReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUpdateVolumeLogic(r.Context(), svcCtx) + resp, err := l.UpdateVolume(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/vm/uploadimagehandler.go b/api/internal/handler/vm/uploadimagehandler.go new file mode 100644 index 00000000..0682d12f --- /dev/null +++ b/api/internal/handler/vm/uploadimagehandler.go @@ -0,0 +1,28 @@ +package vm + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/vm" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func UploadImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UploadOsImageReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := vm.NewUploadImageLogic(r.Context(), svcCtx) + resp, err := l.UploadImage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} From fdee604568dd84fb76cbecd2739d849eea49d0f0 Mon Sep 17 00:00:00 2001 From: qiwang <1364512070@qq.com> Date: Mon, 25 Mar 2024 20:12:38 +0800 Subject: [PATCH 12/15] feat:Add field to create virtual machine Former-commit-id: 6d09c5b808904267920a670487aaa09ba191301c --- .../handler/core/scheduletaskbyyamlhandler.go | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/api/internal/handler/core/scheduletaskbyyamlhandler.go b/api/internal/handler/core/scheduletaskbyyamlhandler.go index 1841a389..c3447137 100644 --- a/api/internal/handler/core/scheduletaskbyyamlhandler.go +++ b/api/internal/handler/core/scheduletaskbyyamlhandler.go @@ -1,6 +1,8 @@ package core import ( + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils" "net/http" "github.com/zeromicro/go-zero/rest/httpx" @@ -13,16 +15,22 @@ func ScheduleTaskByYamlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ScheduleTaskByYamlReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.HttpResult(r, w, nil, err) return } - - l := core.NewScheduleTaskByYamlLogic(r.Context(), svcCtx) - err := l.ScheduleTaskByYaml(&req) + // 解析yaml文件 + _, fileHeader, err := r.FormFile("file") if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) + result.HttpResult(r, w, nil, err) + return } + err = utils.Yaml2struct(fileHeader, &req) + if err != nil { + result.HttpResult(r, w, nil, err) + return + } + l := core.NewScheduleTaskByYamlLogic(r.Context(), svcCtx) + resp, err := l.ScheduleTaskByYaml(&req) + result.HttpResult(r, w, resp, err) } } From 00bee1b8301b2292d542c596d6942dc82b6010da Mon Sep 17 00:00:00 2001 From: qiwang <1364512070@qq.com> Date: Tue, 26 Mar 2024 09:39:01 +0800 Subject: [PATCH 13/15] feat:Add field to create virtual machine Former-commit-id: 4b22f78193ca4d48cf91fac4034ad2bf98345e48 --- api/desc/vm/pcm-vm.api | 1 + api/etc/pcm.yaml | 6 +++--- api/internal/types/types.go | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/api/desc/vm/pcm-vm.api b/api/desc/vm/pcm-vm.api index cb605840..fd095a9b 100644 --- a/api/desc/vm/pcm-vm.api +++ b/api/desc/vm/pcm-vm.api @@ -330,6 +330,7 @@ type ( ErrorMsg string `json:"errorMsg,omitempty"` } Server { + AvailabilityZone string `json:"availability_zone" copier:"AvailabilityZone"` Name string `json:"name,optional" copier:"Name"` FlavorRef string `json:"flavorRef,optional" copier:"FlavorRef"` Description string `json:"description,optional" copier:"Description"` diff --git a/api/etc/pcm.yaml b/api/etc/pcm.yaml index 37a90f85..3e586ba2 100644 --- a/api/etc/pcm.yaml +++ b/api/etc/pcm.yaml @@ -77,9 +77,9 @@ OpenstackRpcConf: # 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: - # - 127.0.0.1:8888 + # 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 diff --git a/api/internal/types/types.go b/api/internal/types/types.go index aeb3d62d..a3bbb150 100644 --- a/api/internal/types/types.go +++ b/api/internal/types/types.go @@ -2882,6 +2882,7 @@ type CreateServerResp struct { } type Server struct { + AvailabilityZone string `json:"availability_zone" copier:"AvailabilityZone"` Name string `json:"name,optional" copier:"Name"` FlavorRef string `json:"flavorRef,optional" copier:"FlavorRef"` Description string `json:"description,optional" copier:"Description"` From 0aba064a940322918726282d5b9181ef3432a9b3 Mon Sep 17 00:00:00 2001 From: jagger Date: Tue, 26 Mar 2024 10:24:00 +0800 Subject: [PATCH 14/15] :bug: fix bugs Signed-off-by: jagger Former-commit-id: 302346812038c54a32d210f989b9a141dd419c30 --- api/internal/handler/adapters/adapterslisthandler.go | 12 ++++-------- api/internal/handler/adapters/clusterlisthandler.go | 12 ++++-------- .../handler/adapters/createadapterhandler.go | 12 ++++-------- .../handler/adapters/createclusterhandler.go | 12 ++++-------- .../handler/adapters/deleteadapterhandler.go | 12 ++++-------- .../handler/adapters/deleteclusterhandler.go | 12 ++++-------- api/internal/handler/adapters/getadapterhandler.go | 12 ++++-------- .../handler/adapters/getadapterrelationhandler.go | 12 ++++-------- api/internal/handler/adapters/getclusterhandler.go | 12 ++++-------- .../handler/adapters/getclustersumhandler.go | 12 ++++-------- .../handler/adapters/updateadapterhandler.go | 12 ++++-------- .../handler/adapters/updateclusterhandler.go | 12 ++++-------- api/internal/handler/ai/createalgorithmhandler.go | 12 ++++-------- api/internal/handler/ai/createdatasethandler.go | 12 ++++-------- api/internal/handler/ai/createexporttaskhandler.go | 12 ++++-------- api/internal/handler/ai/createnotebookhandler.go | 12 ++++-------- .../handler/ai/createprocessortaskhandler.go | 12 ++++-------- api/internal/handler/ai/createservicehandler.go | 12 ++++-------- api/internal/handler/ai/createtaskhandler.go | 12 ++++-------- api/internal/handler/ai/createtrainingjobhandler.go | 12 ++++-------- .../handler/ai/createvisualizationjobhandler.go | 12 ++++-------- api/internal/handler/ai/deletealgorithmhandler.go | 12 ++++-------- api/internal/handler/ai/deletedatasethandler.go | 12 ++++-------- api/internal/handler/ai/deleteservicehandler.go | 12 ++++-------- api/internal/handler/ai/deletetrainingjobhandler.go | 12 ++++-------- .../handler/ai/getexporttasksofdatasethandler.go | 12 ++++-------- .../ai/getexporttaskstatusofdatasethandler.go | 12 ++++-------- .../handler/ai/getlisttrainingjobshandler.go | 12 ++++-------- api/internal/handler/ai/getnotebookstoragehandler.go | 12 ++++-------- .../handler/ai/getvisualizationjobhandler.go | 12 ++++-------- api/internal/handler/ai/listalgorithmshandler.go | 12 ++++-------- api/internal/handler/ai/listclustershandler.go | 12 ++++-------- api/internal/handler/ai/listdatasethandler.go | 12 ++++-------- api/internal/handler/ai/listimporthandler.go | 12 ++++-------- api/internal/handler/ai/listnotebookhandler.go | 12 ++++-------- api/internal/handler/ai/listserviceshandler.go | 12 ++++-------- .../handler/ai/mountnotebookstoragehandler.go | 12 ++++-------- .../handler/ai/showalgorithmbyuuidhandler.go | 12 ++++-------- api/internal/handler/ai/showservicehandler.go | 12 ++++-------- api/internal/handler/ai/startnotebookhandler.go | 12 ++++-------- api/internal/handler/ai/stopnotebookhandler.go | 12 ++++-------- api/internal/handler/apps/appdetailhandler.go | 12 ++++-------- api/internal/handler/apps/applisthandler.go | 12 ++++-------- api/internal/handler/apps/apppodshandler.go | 12 ++++-------- .../handler/apps/deleteappbyappnamehandler.go | 12 ++++-------- api/internal/handler/apps/getappbyappnamehandler.go | 12 ++++-------- .../handler/apps/pauseappbyappnamehandler.go | 12 ++++-------- .../handler/apps/restartappbyappnamehandler.go | 12 ++++-------- .../handler/apps/startappbyappnamehandler.go | 12 ++++-------- .../handler/apps/updateappbyappnamehandler.go | 12 ++++-------- api/internal/handler/cloud/cloudlisthandler.go | 11 +++-------- .../handler/cloud/controllermetricshandler.go | 12 ++++-------- api/internal/handler/cloud/deleteclusterhandler.go | 12 ++++-------- api/internal/handler/cloud/deleteyamlhandler.go | 12 ++++-------- api/internal/handler/cloud/getclusterlisthandler.go | 12 ++++-------- api/internal/handler/cloud/noticetenanthandler.go | 11 +++-------- api/internal/handler/cloud/registerclusterhandler.go | 12 ++++-------- api/internal/handler/cloud/updatetenanthandler.go | 12 ++++-------- api/internal/handler/core/centerresourceshandler.go | 11 +++-------- api/internal/handler/core/committaskhandler.go | 12 ++++-------- api/internal/handler/core/commitvmtaskhandler.go | 12 ++++-------- api/internal/handler/core/deletetaskhandler.go | 12 ++++-------- .../handler/core/getcomputilitystatisticshandler.go | 11 +++-------- .../handler/core/getcomputingpowerhandler.go | 11 +++-------- api/internal/handler/core/getgeneralinfohandler.go | 11 +++-------- api/internal/handler/core/getregionhandler.go | 11 +++-------- .../handler/core/getresourcepanelconfighandler.go | 11 +++-------- api/internal/handler/core/jobtotalhandler.go | 11 +++-------- api/internal/handler/core/listcenterhandler.go | 11 +++-------- api/internal/handler/core/listclusterhandler.go | 12 ++++-------- .../handler/core/listdomainresourcehandler.go | 11 +++-------- api/internal/handler/core/listregionhandler.go | 11 +++-------- api/internal/handler/core/metricshandler.go | 11 +++-------- api/internal/handler/core/nodeassetshandler.go | 11 +++-------- api/internal/handler/core/participantlisthandler.go | 11 +++-------- .../handler/core/putresourcepanelconfighandler.go | 12 ++++-------- api/internal/handler/core/syncclusterloadhandler.go | 12 ++++-------- api/internal/handler/core/taskdetailhandler.go | 12 ++++-------- api/internal/handler/core/tasklisthandler.go | 12 ++++-------- api/internal/handler/dictionary/adddicthandler.go | 12 ++++-------- .../handler/dictionary/adddictitemhandler.go | 12 ++++-------- api/internal/handler/dictionary/deletedicthandler.go | 12 ++++-------- .../handler/dictionary/deletedictitemhandler.go | 12 ++++-------- api/internal/handler/dictionary/editdicthandler.go | 12 ++++-------- .../handler/dictionary/editdictitemhandler.go | 12 ++++-------- api/internal/handler/dictionary/getdicthandler.go | 12 ++++-------- .../handler/dictionary/getdictitemhandler.go | 12 ++++-------- api/internal/handler/dictionary/listdicthandler.go | 12 ++++-------- .../handler/dictionary/listdictitembycodehandler.go | 12 ++++-------- .../handler/dictionary/listdictitemhandler.go | 12 ++++-------- api/internal/handler/hpc/commithpctaskhandler.go | 12 ++++-------- api/internal/handler/hpc/listhistoryjobhandler.go | 12 ++++-------- api/internal/handler/hpc/listjobhandler.go | 12 ++++-------- api/internal/handler/hpc/queueassetshandler.go | 11 +++-------- api/internal/handler/image/chunkhandler.go | 11 +++-------- api/internal/handler/image/datasetcheckhandler.go | 12 ++++-------- api/internal/handler/image/imagelisthandler.go | 11 +++-------- api/internal/handler/image/uploaddatasethandler.go | 11 +++-------- api/internal/handler/image/uploadhandler.go | 11 +++-------- .../schedule/schedulegetairesourcetypeshandler.go | 11 +++-------- .../schedule/schedulegetaitasktypeshandler.go | 11 +++-------- .../handler/schedule/schedulegetdatasetshandler.go | 11 +++-------- .../handler/schedule/schedulegetstrategyhandler.go | 11 +++-------- .../handler/schedule/schedulesubmithandler.go | 12 ++++-------- .../handler/storage/dailypowerscreenhandler.go | 12 ++++-------- .../storage/percentercomputerpowershandler.go | 12 ++++-------- api/internal/handler/storage/screenstoragehandler.go | 12 ++++-------- 107 files changed, 404 insertions(+), 856 deletions(-) diff --git a/api/internal/handler/adapters/adapterslisthandler.go b/api/internal/handler/adapters/adapterslisthandler.go index 3d84c0c8..6ae5c320 100644 --- a/api/internal/handler/adapters/adapterslisthandler.go +++ b/api/internal/handler/adapters/adapterslisthandler.go @@ -1,28 +1,24 @@ package adapters import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func AdaptersListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AdapterQueryReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := adapters.NewAdaptersListLogic(r.Context(), svcCtx) resp, err := l.AdaptersList(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/adapters/clusterlisthandler.go b/api/internal/handler/adapters/clusterlisthandler.go index f1863304..bf168fbc 100644 --- a/api/internal/handler/adapters/clusterlisthandler.go +++ b/api/internal/handler/adapters/clusterlisthandler.go @@ -1,28 +1,24 @@ package adapters import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ClusterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ClusterReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := adapters.NewClusterListLogic(r.Context(), svcCtx) resp, err := l.ClusterList(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/adapters/createadapterhandler.go b/api/internal/handler/adapters/createadapterhandler.go index 42b60968..be20ca49 100644 --- a/api/internal/handler/adapters/createadapterhandler.go +++ b/api/internal/handler/adapters/createadapterhandler.go @@ -1,28 +1,24 @@ package adapters import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func CreateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AdapterCreateReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := adapters.NewCreateAdapterLogic(r.Context(), svcCtx) resp, err := l.CreateAdapter(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/adapters/createclusterhandler.go b/api/internal/handler/adapters/createclusterhandler.go index 80eaa0de..47e1e8b6 100644 --- a/api/internal/handler/adapters/createclusterhandler.go +++ b/api/internal/handler/adapters/createclusterhandler.go @@ -1,28 +1,24 @@ package adapters import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func CreateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ClusterCreateReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := adapters.NewCreateClusterLogic(r.Context(), svcCtx) resp, err := l.CreateCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/adapters/deleteadapterhandler.go b/api/internal/handler/adapters/deleteadapterhandler.go index b2e1c7ca..3b2fb374 100644 --- a/api/internal/handler/adapters/deleteadapterhandler.go +++ b/api/internal/handler/adapters/deleteadapterhandler.go @@ -1,28 +1,24 @@ package adapters import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func DeleteAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AdapterDelReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := adapters.NewDeleteAdapterLogic(r.Context(), svcCtx) resp, err := l.DeleteAdapter(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/adapters/deleteclusterhandler.go b/api/internal/handler/adapters/deleteclusterhandler.go index 62e800f1..2f9d3c9e 100644 --- a/api/internal/handler/adapters/deleteclusterhandler.go +++ b/api/internal/handler/adapters/deleteclusterhandler.go @@ -1,28 +1,24 @@ package adapters import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func DeleteClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.FId if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := adapters.NewDeleteClusterLogic(r.Context(), svcCtx) resp, err := l.DeleteCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/adapters/getadapterhandler.go b/api/internal/handler/adapters/getadapterhandler.go index 2e4e189d..3967cc56 100644 --- a/api/internal/handler/adapters/getadapterhandler.go +++ b/api/internal/handler/adapters/getadapterhandler.go @@ -1,28 +1,24 @@ package adapters import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func GetAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AdapterDelReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := adapters.NewGetAdapterLogic(r.Context(), svcCtx) resp, err := l.GetAdapter(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/adapters/getadapterrelationhandler.go b/api/internal/handler/adapters/getadapterrelationhandler.go index 13212c35..1f265676 100644 --- a/api/internal/handler/adapters/getadapterrelationhandler.go +++ b/api/internal/handler/adapters/getadapterrelationhandler.go @@ -1,28 +1,24 @@ package adapters import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func GetAdapterRelationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AdapterRelationQueryReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := adapters.NewGetAdapterRelationLogic(r.Context(), svcCtx) resp, err := l.GetAdapterRelation(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/adapters/getclusterhandler.go b/api/internal/handler/adapters/getclusterhandler.go index 865e861f..7fe828e9 100644 --- a/api/internal/handler/adapters/getclusterhandler.go +++ b/api/internal/handler/adapters/getclusterhandler.go @@ -1,28 +1,24 @@ package adapters import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func GetClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.FId if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := adapters.NewGetClusterLogic(r.Context(), svcCtx) resp, err := l.GetCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/adapters/getclustersumhandler.go b/api/internal/handler/adapters/getclustersumhandler.go index 18fd747e..bcd6d6af 100644 --- a/api/internal/handler/adapters/getclustersumhandler.go +++ b/api/internal/handler/adapters/getclustersumhandler.go @@ -1,28 +1,24 @@ package adapters import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func GetClusterSumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ClusterSumReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := adapters.NewGetClusterSumLogic(r.Context(), svcCtx) resp, err := l.GetClusterSum(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/adapters/updateadapterhandler.go b/api/internal/handler/adapters/updateadapterhandler.go index 3800fc16..2f9ee8fa 100644 --- a/api/internal/handler/adapters/updateadapterhandler.go +++ b/api/internal/handler/adapters/updateadapterhandler.go @@ -1,28 +1,24 @@ package adapters import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func UpdateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AdapterReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := adapters.NewUpdateAdapterLogic(r.Context(), svcCtx) resp, err := l.UpdateAdapter(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/adapters/updateclusterhandler.go b/api/internal/handler/adapters/updateclusterhandler.go index f5405d64..197d0198 100644 --- a/api/internal/handler/adapters/updateclusterhandler.go +++ b/api/internal/handler/adapters/updateclusterhandler.go @@ -1,28 +1,24 @@ package adapters import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func UpdateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ClusterCreateReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := adapters.NewUpdateClusterLogic(r.Context(), svcCtx) resp, err := l.UpdateCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/createalgorithmhandler.go b/api/internal/handler/ai/createalgorithmhandler.go index e0ebcb34..f6c4e3bb 100644 --- a/api/internal/handler/ai/createalgorithmhandler.go +++ b/api/internal/handler/ai/createalgorithmhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewCreateAlgorithmLogic(r.Context(), svcCtx) resp, err := l.CreateAlgorithm(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/createdatasethandler.go b/api/internal/handler/ai/createdatasethandler.go index 57bb2728..424005b4 100644 --- a/api/internal/handler/ai/createdatasethandler.go +++ b/api/internal/handler/ai/createdatasethandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewCreateDataSetLogic(r.Context(), svcCtx) resp, err := l.CreateDataSet(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/createexporttaskhandler.go b/api/internal/handler/ai/createexporttaskhandler.go index bcc64381..7dbf1228 100644 --- a/api/internal/handler/ai/createexporttaskhandler.go +++ b/api/internal/handler/ai/createexporttaskhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewCreateExportTaskLogic(r.Context(), svcCtx) resp, err := l.CreateExportTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/createnotebookhandler.go b/api/internal/handler/ai/createnotebookhandler.go index 4bf997fc..14dd0460 100644 --- a/api/internal/handler/ai/createnotebookhandler.go +++ b/api/internal/handler/ai/createnotebookhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewCreateNotebookLogic(r.Context(), svcCtx) resp, err := l.CreateNotebook(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/createprocessortaskhandler.go b/api/internal/handler/ai/createprocessortaskhandler.go index b2dc6f55..00167d1e 100644 --- a/api/internal/handler/ai/createprocessortaskhandler.go +++ b/api/internal/handler/ai/createprocessortaskhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewCreateProcessorTaskLogic(r.Context(), svcCtx) resp, err := l.CreateProcessorTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/createservicehandler.go b/api/internal/handler/ai/createservicehandler.go index dd8ef32a..4d9159ac 100644 --- a/api/internal/handler/ai/createservicehandler.go +++ b/api/internal/handler/ai/createservicehandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewCreateServiceLogic(r.Context(), svcCtx) resp, err := l.CreateService(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/createtaskhandler.go b/api/internal/handler/ai/createtaskhandler.go index c1632e63..85c62920 100644 --- a/api/internal/handler/ai/createtaskhandler.go +++ b/api/internal/handler/ai/createtaskhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewCreateTaskLogic(r.Context(), svcCtx) resp, err := l.CreateTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/createtrainingjobhandler.go b/api/internal/handler/ai/createtrainingjobhandler.go index f159bf06..f0c3eb9b 100644 --- a/api/internal/handler/ai/createtrainingjobhandler.go +++ b/api/internal/handler/ai/createtrainingjobhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewCreateTrainingJobLogic(r.Context(), svcCtx) resp, err := l.CreateTrainingJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/createvisualizationjobhandler.go b/api/internal/handler/ai/createvisualizationjobhandler.go index b66ffa7c..971404ea 100644 --- a/api/internal/handler/ai/createvisualizationjobhandler.go +++ b/api/internal/handler/ai/createvisualizationjobhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewCreateVisualizationJobLogic(r.Context(), svcCtx) resp, err := l.CreateVisualizationJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/deletealgorithmhandler.go b/api/internal/handler/ai/deletealgorithmhandler.go index 57630af0..74597272 100644 --- a/api/internal/handler/ai/deletealgorithmhandler.go +++ b/api/internal/handler/ai/deletealgorithmhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewDeleteAlgorithmLogic(r.Context(), svcCtx) resp, err := l.DeleteAlgorithm(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/deletedatasethandler.go b/api/internal/handler/ai/deletedatasethandler.go index 84288d1c..7457bee0 100644 --- a/api/internal/handler/ai/deletedatasethandler.go +++ b/api/internal/handler/ai/deletedatasethandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewDeleteDataSetLogic(r.Context(), svcCtx) resp, err := l.DeleteDataSet(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/deleteservicehandler.go b/api/internal/handler/ai/deleteservicehandler.go index effb9aad..b65826fb 100644 --- a/api/internal/handler/ai/deleteservicehandler.go +++ b/api/internal/handler/ai/deleteservicehandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewDeleteServiceLogic(r.Context(), svcCtx) resp, err := l.DeleteService(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/deletetrainingjobhandler.go b/api/internal/handler/ai/deletetrainingjobhandler.go index d0666ef7..ae789acb 100644 --- a/api/internal/handler/ai/deletetrainingjobhandler.go +++ b/api/internal/handler/ai/deletetrainingjobhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewDeleteTrainingJobLogic(r.Context(), svcCtx) resp, err := l.DeleteTrainingJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/getexporttasksofdatasethandler.go b/api/internal/handler/ai/getexporttasksofdatasethandler.go index bf45832a..f500affd 100644 --- a/api/internal/handler/ai/getexporttasksofdatasethandler.go +++ b/api/internal/handler/ai/getexporttasksofdatasethandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewGetExportTasksOfDatasetLogic(r.Context(), svcCtx) resp, err := l.GetExportTasksOfDataset(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go b/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go index 3a7c0337..eb41f009 100644 --- a/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go +++ b/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewGetExportTaskStatusOfDatasetLogic(r.Context(), svcCtx) resp, err := l.GetExportTaskStatusOfDataset(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/getlisttrainingjobshandler.go b/api/internal/handler/ai/getlisttrainingjobshandler.go index 3f978dba..51002c46 100644 --- a/api/internal/handler/ai/getlisttrainingjobshandler.go +++ b/api/internal/handler/ai/getlisttrainingjobshandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewGetListTrainingJobsLogic(r.Context(), svcCtx) resp, err := l.GetListTrainingJobs(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/getnotebookstoragehandler.go b/api/internal/handler/ai/getnotebookstoragehandler.go index 2c7618c8..9d7de093 100644 --- a/api/internal/handler/ai/getnotebookstoragehandler.go +++ b/api/internal/handler/ai/getnotebookstoragehandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewGetNotebookStorageLogic(r.Context(), svcCtx) resp, err := l.GetNotebookStorage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/getvisualizationjobhandler.go b/api/internal/handler/ai/getvisualizationjobhandler.go index 51f41ed1..629b9707 100644 --- a/api/internal/handler/ai/getvisualizationjobhandler.go +++ b/api/internal/handler/ai/getvisualizationjobhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewGetVisualizationJobLogic(r.Context(), svcCtx) resp, err := l.GetVisualizationJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/listalgorithmshandler.go b/api/internal/handler/ai/listalgorithmshandler.go index 56c2ded7..9e3b0035 100644 --- a/api/internal/handler/ai/listalgorithmshandler.go +++ b/api/internal/handler/ai/listalgorithmshandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewListAlgorithmsLogic(r.Context(), svcCtx) resp, err := l.ListAlgorithms(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/listclustershandler.go b/api/internal/handler/ai/listclustershandler.go index 50ad73bd..261d2512 100644 --- a/api/internal/handler/ai/listclustershandler.go +++ b/api/internal/handler/ai/listclustershandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewListClustersLogic(r.Context(), svcCtx) resp, err := l.ListClusters(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/listdatasethandler.go b/api/internal/handler/ai/listdatasethandler.go index 78f06ffa..bb134718 100644 --- a/api/internal/handler/ai/listdatasethandler.go +++ b/api/internal/handler/ai/listdatasethandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewListDataSetLogic(r.Context(), svcCtx) resp, err := l.ListDataSet(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/listimporthandler.go b/api/internal/handler/ai/listimporthandler.go index 32a8c6d0..2faa5689 100644 --- a/api/internal/handler/ai/listimporthandler.go +++ b/api/internal/handler/ai/listimporthandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewListImportLogic(r.Context(), svcCtx) resp, err := l.ListImport(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/listnotebookhandler.go b/api/internal/handler/ai/listnotebookhandler.go index b1375aeb..a8da51d5 100644 --- a/api/internal/handler/ai/listnotebookhandler.go +++ b/api/internal/handler/ai/listnotebookhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewListNotebookLogic(r.Context(), svcCtx) resp, err := l.ListNotebook(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/listserviceshandler.go b/api/internal/handler/ai/listserviceshandler.go index df823191..0f2266a6 100644 --- a/api/internal/handler/ai/listserviceshandler.go +++ b/api/internal/handler/ai/listserviceshandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewListServicesLogic(r.Context(), svcCtx) resp, err := l.ListServices(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/mountnotebookstoragehandler.go b/api/internal/handler/ai/mountnotebookstoragehandler.go index 324c9708..3b1ac77d 100644 --- a/api/internal/handler/ai/mountnotebookstoragehandler.go +++ b/api/internal/handler/ai/mountnotebookstoragehandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewMountNotebookStorageLogic(r.Context(), svcCtx) resp, err := l.MountNotebookStorage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/showalgorithmbyuuidhandler.go b/api/internal/handler/ai/showalgorithmbyuuidhandler.go index a2951560..73bdde4f 100644 --- a/api/internal/handler/ai/showalgorithmbyuuidhandler.go +++ b/api/internal/handler/ai/showalgorithmbyuuidhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewShowAlgorithmByUuidLogic(r.Context(), svcCtx) resp, err := l.ShowAlgorithmByUuid(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/showservicehandler.go b/api/internal/handler/ai/showservicehandler.go index d6a9f4b4..c63b177f 100644 --- a/api/internal/handler/ai/showservicehandler.go +++ b/api/internal/handler/ai/showservicehandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewShowServiceLogic(r.Context(), svcCtx) resp, err := l.ShowService(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/startnotebookhandler.go b/api/internal/handler/ai/startnotebookhandler.go index 1416d911..39706c24 100644 --- a/api/internal/handler/ai/startnotebookhandler.go +++ b/api/internal/handler/ai/startnotebookhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewStartNotebookLogic(r.Context(), svcCtx) resp, err := l.StartNotebook(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/stopnotebookhandler.go b/api/internal/handler/ai/stopnotebookhandler.go index b6fd7cce..4fc89e79 100644 --- a/api/internal/handler/ai/stopnotebookhandler.go +++ b/api/internal/handler/ai/stopnotebookhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewStopNotebookLogic(r.Context(), svcCtx) resp, err := l.StopNotebook(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/appdetailhandler.go b/api/internal/handler/apps/appdetailhandler.go index d668a226..926c813d 100644 --- a/api/internal/handler/apps/appdetailhandler.go +++ b/api/internal/handler/apps/appdetailhandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func AppDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AppDetailReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewAppDetailLogic(r.Context(), svcCtx) resp, err := l.AppDetail(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/applisthandler.go b/api/internal/handler/apps/applisthandler.go index 823cb985..831302e9 100644 --- a/api/internal/handler/apps/applisthandler.go +++ b/api/internal/handler/apps/applisthandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func AppListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AppListReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewAppListLogic(r.Context(), svcCtx) resp, err := l.AppList(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/apppodshandler.go b/api/internal/handler/apps/apppodshandler.go index ef3e0466..606af91e 100644 --- a/api/internal/handler/apps/apppodshandler.go +++ b/api/internal/handler/apps/apppodshandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func AppPodsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AppDetailReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewAppPodsLogic(r.Context(), svcCtx) resp, err := l.AppPods(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/deleteappbyappnamehandler.go b/api/internal/handler/apps/deleteappbyappnamehandler.go index a6c9efa6..65aebb78 100644 --- a/api/internal/handler/apps/deleteappbyappnamehandler.go +++ b/api/internal/handler/apps/deleteappbyappnamehandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func DeleteAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteAppReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewDeleteAppByAppNameLogic(r.Context(), svcCtx) resp, err := l.DeleteAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/getappbyappnamehandler.go b/api/internal/handler/apps/getappbyappnamehandler.go index d7dd16c2..47877edd 100644 --- a/api/internal/handler/apps/getappbyappnamehandler.go +++ b/api/internal/handler/apps/getappbyappnamehandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func GetAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AppDetailReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewGetAppByAppNameLogic(r.Context(), svcCtx) resp, err := l.GetAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/pauseappbyappnamehandler.go b/api/internal/handler/apps/pauseappbyappnamehandler.go index a53de1ab..40f727b1 100644 --- a/api/internal/handler/apps/pauseappbyappnamehandler.go +++ b/api/internal/handler/apps/pauseappbyappnamehandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func PauseAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteAppReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewPauseAppByAppNameLogic(r.Context(), svcCtx) resp, err := l.PauseAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/restartappbyappnamehandler.go b/api/internal/handler/apps/restartappbyappnamehandler.go index 94b246af..7e1be056 100644 --- a/api/internal/handler/apps/restartappbyappnamehandler.go +++ b/api/internal/handler/apps/restartappbyappnamehandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func RestartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteAppReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewRestartAppByAppNameLogic(r.Context(), svcCtx) resp, err := l.RestartAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/startappbyappnamehandler.go b/api/internal/handler/apps/startappbyappnamehandler.go index 02b6a98b..f49a2529 100644 --- a/api/internal/handler/apps/startappbyappnamehandler.go +++ b/api/internal/handler/apps/startappbyappnamehandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func StartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteAppReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewStartAppByAppNameLogic(r.Context(), svcCtx) resp, err := l.StartAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/updateappbyappnamehandler.go b/api/internal/handler/apps/updateappbyappnamehandler.go index e72740b8..bf77676b 100644 --- a/api/internal/handler/apps/updateappbyappnamehandler.go +++ b/api/internal/handler/apps/updateappbyappnamehandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func UpdateAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteAppReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewUpdateAppByAppNameLogic(r.Context(), svcCtx) resp, err := l.UpdateAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/cloud/cloudlisthandler.go b/api/internal/handler/cloud/cloudlisthandler.go index 22c759c4..524dc511 100644 --- a/api/internal/handler/cloud/cloudlisthandler.go +++ b/api/internal/handler/cloud/cloudlisthandler.go @@ -1,21 +1,16 @@ package cloud import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/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() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/cloud/controllermetricshandler.go b/api/internal/handler/cloud/controllermetricshandler.go index 2e02cf43..83aa7595 100644 --- a/api/internal/handler/cloud/controllermetricshandler.go +++ b/api/internal/handler/cloud/controllermetricshandler.go @@ -1,28 +1,24 @@ package cloud import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := cloud.NewControllerMetricsLogic(r.Context(), svcCtx) resp, err := l.ControllerMetrics(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/cloud/deleteclusterhandler.go b/api/internal/handler/cloud/deleteclusterhandler.go index 323c25f3..7c27c7d0 100644 --- a/api/internal/handler/cloud/deleteclusterhandler.go +++ b/api/internal/handler/cloud/deleteclusterhandler.go @@ -1,28 +1,24 @@ package cloud import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := cloud.NewDeleteClusterLogic(r.Context(), svcCtx) resp, err := l.DeleteCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/cloud/deleteyamlhandler.go b/api/internal/handler/cloud/deleteyamlhandler.go index 60a01556..d4eb7b7b 100644 --- a/api/internal/handler/cloud/deleteyamlhandler.go +++ b/api/internal/handler/cloud/deleteyamlhandler.go @@ -1,28 +1,24 @@ package cloud import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := cloud.NewDeleteYamlLogic(r.Context(), svcCtx) resp, err := l.DeleteYaml(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/cloud/getclusterlisthandler.go b/api/internal/handler/cloud/getclusterlisthandler.go index cc04e75d..0363e174 100644 --- a/api/internal/handler/cloud/getclusterlisthandler.go +++ b/api/internal/handler/cloud/getclusterlisthandler.go @@ -1,28 +1,24 @@ package cloud import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := cloud.NewGetClusterListLogic(r.Context(), svcCtx) resp, err := l.GetClusterList(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/cloud/noticetenanthandler.go b/api/internal/handler/cloud/noticetenanthandler.go index 9b3fea29..89a510ed 100644 --- a/api/internal/handler/cloud/noticetenanthandler.go +++ b/api/internal/handler/cloud/noticetenanthandler.go @@ -1,21 +1,16 @@ package cloud import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func NoticeTenantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := cloud.NewNoticeTenantLogic(r.Context(), svcCtx) resp, err := l.NoticeTenant() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/cloud/registerclusterhandler.go b/api/internal/handler/cloud/registerclusterhandler.go index f222e5be..54deafb0 100644 --- a/api/internal/handler/cloud/registerclusterhandler.go +++ b/api/internal/handler/cloud/registerclusterhandler.go @@ -1,28 +1,24 @@ package cloud import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "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 { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := cloud.NewRegisterClusterLogic(r.Context(), svcCtx) resp, err := l.RegisterCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/cloud/updatetenanthandler.go b/api/internal/handler/cloud/updatetenanthandler.go index 04b04e32..e1f69de5 100644 --- a/api/internal/handler/cloud/updatetenanthandler.go +++ b/api/internal/handler/cloud/updatetenanthandler.go @@ -1,28 +1,24 @@ package cloud import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func UpdateTenantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.UpdateTenantReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := cloud.NewUpdateTenantLogic(r.Context(), svcCtx) resp, err := l.UpdateTenant(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/core/centerresourceshandler.go b/api/internal/handler/core/centerresourceshandler.go index 6c7ae71e..31aef57b 100644 --- a/api/internal/handler/core/centerresourceshandler.go +++ b/api/internal/handler/core/centerresourceshandler.go @@ -1,21 +1,16 @@ 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/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() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/core/committaskhandler.go b/api/internal/handler/core/committaskhandler.go index 3bea0b93..b0642b7c 100644 --- a/api/internal/handler/core/committaskhandler.go +++ b/api/internal/handler/core/committaskhandler.go @@ -1,28 +1,24 @@ package core import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func CommitTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CommitTaskReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := core.NewCommitTaskLogic(r.Context(), svcCtx) err := l.CommitTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } + result.HttpResult(r, w, nil, err) } } diff --git a/api/internal/handler/core/commitvmtaskhandler.go b/api/internal/handler/core/commitvmtaskhandler.go index f2ca9e4b..7f8ab825 100644 --- a/api/internal/handler/core/commitvmtaskhandler.go +++ b/api/internal/handler/core/commitvmtaskhandler.go @@ -1,28 +1,24 @@ package core import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func CommitVmTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CommitVmTaskReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := core.NewCommitVmTaskLogic(r.Context(), svcCtx) resp, err := l.CommitVmTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/core/deletetaskhandler.go b/api/internal/handler/core/deletetaskhandler.go index e5a735e0..b922b88b 100644 --- a/api/internal/handler/core/deletetaskhandler.go +++ b/api/internal/handler/core/deletetaskhandler.go @@ -1,28 +1,24 @@ package core import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func DeleteTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteTaskReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := core.NewDeleteTaskLogic(r.Context(), svcCtx) err := l.DeleteTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } + result.HttpResult(r, w, nil, err) } } diff --git a/api/internal/handler/core/getcomputilitystatisticshandler.go b/api/internal/handler/core/getcomputilitystatisticshandler.go index 8a03ba36..06183c83 100644 --- a/api/internal/handler/core/getcomputilitystatisticshandler.go +++ b/api/internal/handler/core/getcomputilitystatisticshandler.go @@ -1,21 +1,16 @@ 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/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() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/core/getcomputingpowerhandler.go b/api/internal/handler/core/getcomputingpowerhandler.go index 9e4c77ed..9f031ac0 100644 --- a/api/internal/handler/core/getcomputingpowerhandler.go +++ b/api/internal/handler/core/getcomputingpowerhandler.go @@ -1,21 +1,16 @@ 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/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() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/core/getgeneralinfohandler.go b/api/internal/handler/core/getgeneralinfohandler.go index de4dc89f..614e1954 100644 --- a/api/internal/handler/core/getgeneralinfohandler.go +++ b/api/internal/handler/core/getgeneralinfohandler.go @@ -1,21 +1,16 @@ 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/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() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/core/getregionhandler.go b/api/internal/handler/core/getregionhandler.go index f85e16c7..3b884280 100644 --- a/api/internal/handler/core/getregionhandler.go +++ b/api/internal/handler/core/getregionhandler.go @@ -1,21 +1,16 @@ 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/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() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/core/getresourcepanelconfighandler.go b/api/internal/handler/core/getresourcepanelconfighandler.go index 45dde0c1..bc84d068 100644 --- a/api/internal/handler/core/getresourcepanelconfighandler.go +++ b/api/internal/handler/core/getresourcepanelconfighandler.go @@ -1,21 +1,16 @@ 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/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() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/core/jobtotalhandler.go b/api/internal/handler/core/jobtotalhandler.go index 91caa200..0d59f6bc 100644 --- a/api/internal/handler/core/jobtotalhandler.go +++ b/api/internal/handler/core/jobtotalhandler.go @@ -1,21 +1,16 @@ 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/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() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/core/listcenterhandler.go b/api/internal/handler/core/listcenterhandler.go index cf988c03..0c7b8c4f 100644 --- a/api/internal/handler/core/listcenterhandler.go +++ b/api/internal/handler/core/listcenterhandler.go @@ -1,21 +1,16 @@ 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/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() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/core/listclusterhandler.go b/api/internal/handler/core/listclusterhandler.go index a2077a06..96fa7279 100644 --- a/api/internal/handler/core/listclusterhandler.go +++ b/api/internal/handler/core/listclusterhandler.go @@ -1,28 +1,24 @@ package core import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ListClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ListClusterReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := core.NewListClusterLogic(r.Context(), svcCtx) resp, err := l.ListCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/core/listdomainresourcehandler.go b/api/internal/handler/core/listdomainresourcehandler.go index 911beacf..3b681ac3 100644 --- a/api/internal/handler/core/listdomainresourcehandler.go +++ b/api/internal/handler/core/listdomainresourcehandler.go @@ -1,21 +1,16 @@ 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/pkg/repository/result" + "net/http" ) func ListDomainResourceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := core.NewListDomainResourceLogic(r.Context(), svcCtx) resp, err := l.ListDomainResource() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/core/listregionhandler.go b/api/internal/handler/core/listregionhandler.go index c05760a6..80d60ef8 100644 --- a/api/internal/handler/core/listregionhandler.go +++ b/api/internal/handler/core/listregionhandler.go @@ -1,21 +1,16 @@ 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/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() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/core/metricshandler.go b/api/internal/handler/core/metricshandler.go index 5f715b1d..b3ca8b79 100644 --- a/api/internal/handler/core/metricshandler.go +++ b/api/internal/handler/core/metricshandler.go @@ -1,21 +1,16 @@ 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/pkg/repository/result" + "net/http" ) func MetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := core.NewMetricsLogic(r.Context(), svcCtx) err := l.Metrics() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } + result.HttpResult(r, w, nil, err) } } diff --git a/api/internal/handler/core/nodeassetshandler.go b/api/internal/handler/core/nodeassetshandler.go index f8bd04a4..9117fb16 100644 --- a/api/internal/handler/core/nodeassetshandler.go +++ b/api/internal/handler/core/nodeassetshandler.go @@ -1,21 +1,16 @@ 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/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() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/core/participantlisthandler.go b/api/internal/handler/core/participantlisthandler.go index 1f122e0f..c6795eef 100644 --- a/api/internal/handler/core/participantlisthandler.go +++ b/api/internal/handler/core/participantlisthandler.go @@ -1,21 +1,16 @@ 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/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() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/core/putresourcepanelconfighandler.go b/api/internal/handler/core/putresourcepanelconfighandler.go index a425f19a..0700c6cd 100644 --- a/api/internal/handler/core/putresourcepanelconfighandler.go +++ b/api/internal/handler/core/putresourcepanelconfighandler.go @@ -1,28 +1,24 @@ package core import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func PutResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ResourcePanelConfigReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := core.NewPutResourcePanelConfigLogic(r.Context(), svcCtx) err := l.PutResourcePanelConfig(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } + result.HttpResult(r, w, nil, err) } } diff --git a/api/internal/handler/core/syncclusterloadhandler.go b/api/internal/handler/core/syncclusterloadhandler.go index ff36e15b..da5f6f1b 100644 --- a/api/internal/handler/core/syncclusterloadhandler.go +++ b/api/internal/handler/core/syncclusterloadhandler.go @@ -1,28 +1,24 @@ package core import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func SyncClusterLoadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.SyncClusterLoadReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := core.NewSyncClusterLoadLogic(r.Context(), svcCtx) err := l.SyncClusterLoad(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } + result.HttpResult(r, w, nil, err) } } diff --git a/api/internal/handler/core/taskdetailhandler.go b/api/internal/handler/core/taskdetailhandler.go index e97f2706..646bbe43 100644 --- a/api/internal/handler/core/taskdetailhandler.go +++ b/api/internal/handler/core/taskdetailhandler.go @@ -1,28 +1,24 @@ package core import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func TaskDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.TaskDetailReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := core.NewTaskDetailLogic(r.Context(), svcCtx) resp, err := l.TaskDetail(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/core/tasklisthandler.go b/api/internal/handler/core/tasklisthandler.go index 7b239009..3a16cb02 100644 --- a/api/internal/handler/core/tasklisthandler.go +++ b/api/internal/handler/core/tasklisthandler.go @@ -1,28 +1,24 @@ package core import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func TaskListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.TaskListReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := core.NewTaskListLogic(r.Context(), svcCtx) resp, err := l.TaskList(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/dictionary/adddicthandler.go b/api/internal/handler/dictionary/adddicthandler.go index 9abc0f7a..f97da1bb 100644 --- a/api/internal/handler/dictionary/adddicthandler.go +++ b/api/internal/handler/dictionary/adddicthandler.go @@ -1,28 +1,24 @@ package dictionary import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func AddDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictEditReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := dictionary.NewAddDictLogic(r.Context(), svcCtx) resp, err := l.AddDict(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/dictionary/adddictitemhandler.go b/api/internal/handler/dictionary/adddictitemhandler.go index c1ab2c69..44dbe883 100644 --- a/api/internal/handler/dictionary/adddictitemhandler.go +++ b/api/internal/handler/dictionary/adddictitemhandler.go @@ -1,28 +1,24 @@ package dictionary import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func AddDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictItemEditReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := dictionary.NewAddDictItemLogic(r.Context(), svcCtx) resp, err := l.AddDictItem(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/dictionary/deletedicthandler.go b/api/internal/handler/dictionary/deletedicthandler.go index 435f529e..e65e54c2 100644 --- a/api/internal/handler/dictionary/deletedicthandler.go +++ b/api/internal/handler/dictionary/deletedicthandler.go @@ -1,28 +1,24 @@ package dictionary import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func DeleteDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CId if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := dictionary.NewDeleteDictLogic(r.Context(), svcCtx) resp, err := l.DeleteDict(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/dictionary/deletedictitemhandler.go b/api/internal/handler/dictionary/deletedictitemhandler.go index e029202f..65139c09 100644 --- a/api/internal/handler/dictionary/deletedictitemhandler.go +++ b/api/internal/handler/dictionary/deletedictitemhandler.go @@ -1,28 +1,24 @@ package dictionary import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func DeleteDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CId if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := dictionary.NewDeleteDictItemLogic(r.Context(), svcCtx) resp, err := l.DeleteDictItem(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/dictionary/editdicthandler.go b/api/internal/handler/dictionary/editdicthandler.go index b63e41be..fe0ef391 100644 --- a/api/internal/handler/dictionary/editdicthandler.go +++ b/api/internal/handler/dictionary/editdicthandler.go @@ -1,28 +1,24 @@ package dictionary import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func EditDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictEditReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := dictionary.NewEditDictLogic(r.Context(), svcCtx) resp, err := l.EditDict(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/dictionary/editdictitemhandler.go b/api/internal/handler/dictionary/editdictitemhandler.go index f4f2fd6c..295e9095 100644 --- a/api/internal/handler/dictionary/editdictitemhandler.go +++ b/api/internal/handler/dictionary/editdictitemhandler.go @@ -1,28 +1,24 @@ package dictionary import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func EditDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictItemEditReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := dictionary.NewEditDictItemLogic(r.Context(), svcCtx) resp, err := l.EditDictItem(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/dictionary/getdicthandler.go b/api/internal/handler/dictionary/getdicthandler.go index 4a958990..b1b56d0d 100644 --- a/api/internal/handler/dictionary/getdicthandler.go +++ b/api/internal/handler/dictionary/getdicthandler.go @@ -1,28 +1,24 @@ package dictionary import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func GetDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CId if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := dictionary.NewGetDictLogic(r.Context(), svcCtx) resp, err := l.GetDict(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/dictionary/getdictitemhandler.go b/api/internal/handler/dictionary/getdictitemhandler.go index 60d8ce06..bbfe113f 100644 --- a/api/internal/handler/dictionary/getdictitemhandler.go +++ b/api/internal/handler/dictionary/getdictitemhandler.go @@ -1,28 +1,24 @@ package dictionary import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func GetDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CId if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := dictionary.NewGetDictItemLogic(r.Context(), svcCtx) resp, err := l.GetDictItem(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/dictionary/listdicthandler.go b/api/internal/handler/dictionary/listdicthandler.go index 5c34a136..72dac7c8 100644 --- a/api/internal/handler/dictionary/listdicthandler.go +++ b/api/internal/handler/dictionary/listdicthandler.go @@ -1,28 +1,24 @@ package dictionary import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ListDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := dictionary.NewListDictLogic(r.Context(), svcCtx) resp, err := l.ListDict(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/dictionary/listdictitembycodehandler.go b/api/internal/handler/dictionary/listdictitembycodehandler.go index 98c6feab..c6400185 100644 --- a/api/internal/handler/dictionary/listdictitembycodehandler.go +++ b/api/internal/handler/dictionary/listdictitembycodehandler.go @@ -1,28 +1,24 @@ package dictionary import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ListDictItemByCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictCodeReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := dictionary.NewListDictItemByCodeLogic(r.Context(), svcCtx) resp, err := l.ListDictItemByCode(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/dictionary/listdictitemhandler.go b/api/internal/handler/dictionary/listdictitemhandler.go index 5607ee04..16df182d 100644 --- a/api/internal/handler/dictionary/listdictitemhandler.go +++ b/api/internal/handler/dictionary/listdictitemhandler.go @@ -1,28 +1,24 @@ package dictionary import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ListDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DictItemReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := dictionary.NewListDictItemLogic(r.Context(), svcCtx) resp, err := l.ListDictItem(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/hpc/commithpctaskhandler.go b/api/internal/handler/hpc/commithpctaskhandler.go index a2043def..7408b559 100644 --- a/api/internal/handler/hpc/commithpctaskhandler.go +++ b/api/internal/handler/hpc/commithpctaskhandler.go @@ -1,28 +1,24 @@ package hpc import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func CommitHpcTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CommitHpcTaskReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := hpc.NewCommitHpcTaskLogic(r.Context(), svcCtx) resp, err := l.CommitHpcTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/hpc/listhistoryjobhandler.go b/api/internal/handler/hpc/listhistoryjobhandler.go index ec50c854..f37ce3fc 100644 --- a/api/internal/handler/hpc/listhistoryjobhandler.go +++ b/api/internal/handler/hpc/listhistoryjobhandler.go @@ -1,28 +1,24 @@ package hpc import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ListHistoryJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ListHistoryJobReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := hpc.NewListHistoryJobLogic(r.Context(), svcCtx) resp, err := l.ListHistoryJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/hpc/listjobhandler.go b/api/internal/handler/hpc/listjobhandler.go index c9572a7e..53a3b782 100644 --- a/api/internal/handler/hpc/listjobhandler.go +++ b/api/internal/handler/hpc/listjobhandler.go @@ -1,28 +1,24 @@ package hpc import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ListJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ListJobReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := hpc.NewListJobLogic(r.Context(), svcCtx) resp, err := l.ListJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/hpc/queueassetshandler.go b/api/internal/handler/hpc/queueassetshandler.go index 97c0c5d4..135d88bd 100644 --- a/api/internal/handler/hpc/queueassetshandler.go +++ b/api/internal/handler/hpc/queueassetshandler.go @@ -1,21 +1,16 @@ package hpc import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func QueueAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := hpc.NewQueueAssetsLogic(r.Context(), svcCtx) resp, err := l.QueueAssets() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/image/chunkhandler.go b/api/internal/handler/image/chunkhandler.go index 87c8b143..5d87cd8c 100644 --- a/api/internal/handler/image/chunkhandler.go +++ b/api/internal/handler/image/chunkhandler.go @@ -1,21 +1,16 @@ package image import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ChunkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := image.NewChunkLogic(r.Context(), svcCtx) err := l.Chunk() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } + result.HttpResult(r, w, nil, err) } } diff --git a/api/internal/handler/image/datasetcheckhandler.go b/api/internal/handler/image/datasetcheckhandler.go index b127987b..74803223 100644 --- a/api/internal/handler/image/datasetcheckhandler.go +++ b/api/internal/handler/image/datasetcheckhandler.go @@ -1,28 +1,24 @@ package image import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func DataSetCheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CheckReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := image.NewDataSetCheckLogic(r.Context(), svcCtx) resp, err := l.DataSetCheck(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/image/imagelisthandler.go b/api/internal/handler/image/imagelisthandler.go index cbd14726..b2dea764 100644 --- a/api/internal/handler/image/imagelisthandler.go +++ b/api/internal/handler/image/imagelisthandler.go @@ -1,21 +1,16 @@ package image import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ImageListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := image.NewImageListLogic(r.Context(), svcCtx) resp, err := l.ImageList() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/image/uploaddatasethandler.go b/api/internal/handler/image/uploaddatasethandler.go index ffe715c6..27b2eb9a 100644 --- a/api/internal/handler/image/uploaddatasethandler.go +++ b/api/internal/handler/image/uploaddatasethandler.go @@ -1,21 +1,16 @@ package image import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func UploadDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := image.NewUploadDataSetLogic(r.Context(), svcCtx) err := l.UploadDataSet() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } + result.HttpResult(r, w, nil, err) } } diff --git a/api/internal/handler/image/uploadhandler.go b/api/internal/handler/image/uploadhandler.go index 66cd4592..bfc73030 100644 --- a/api/internal/handler/image/uploadhandler.go +++ b/api/internal/handler/image/uploadhandler.go @@ -1,21 +1,16 @@ package image import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func UploadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := image.NewUploadLogic(r.Context(), svcCtx) err := l.Upload() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } + result.HttpResult(r, w, nil, err) } } diff --git a/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go b/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go index 430786f2..82b876ae 100644 --- a/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go +++ b/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go @@ -1,21 +1,16 @@ package schedule import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ScheduleGetAiResourceTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := schedule.NewScheduleGetAiResourceTypesLogic(r.Context(), svcCtx) resp, err := l.ScheduleGetAiResourceTypes() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/schedule/schedulegetaitasktypeshandler.go b/api/internal/handler/schedule/schedulegetaitasktypeshandler.go index 5be11070..db45b9c5 100644 --- a/api/internal/handler/schedule/schedulegetaitasktypeshandler.go +++ b/api/internal/handler/schedule/schedulegetaitasktypeshandler.go @@ -1,21 +1,16 @@ package schedule import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ScheduleGetAiTaskTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := schedule.NewScheduleGetAiTaskTypesLogic(r.Context(), svcCtx) resp, err := l.ScheduleGetAiTaskTypes() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/schedule/schedulegetdatasetshandler.go b/api/internal/handler/schedule/schedulegetdatasetshandler.go index da285546..5dc32bb7 100644 --- a/api/internal/handler/schedule/schedulegetdatasetshandler.go +++ b/api/internal/handler/schedule/schedulegetdatasetshandler.go @@ -1,21 +1,16 @@ package schedule import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ScheduleGetDatasetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := schedule.NewScheduleGetDatasetsLogic(r.Context(), svcCtx) resp, err := l.ScheduleGetDatasets() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/schedule/schedulegetstrategyhandler.go b/api/internal/handler/schedule/schedulegetstrategyhandler.go index 2ee88fba..4771495c 100644 --- a/api/internal/handler/schedule/schedulegetstrategyhandler.go +++ b/api/internal/handler/schedule/schedulegetstrategyhandler.go @@ -1,21 +1,16 @@ package schedule import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ScheduleGetStrategyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := schedule.NewScheduleGetStrategyLogic(r.Context(), svcCtx) resp, err := l.ScheduleGetStrategy() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/schedule/schedulesubmithandler.go b/api/internal/handler/schedule/schedulesubmithandler.go index a536f649..d6e2a538 100644 --- a/api/internal/handler/schedule/schedulesubmithandler.go +++ b/api/internal/handler/schedule/schedulesubmithandler.go @@ -1,28 +1,24 @@ package schedule import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ScheduleSubmitHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ScheduleReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := schedule.NewScheduleSubmitLogic(r.Context(), svcCtx) resp, err := l.ScheduleSubmit(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/storage/dailypowerscreenhandler.go b/api/internal/handler/storage/dailypowerscreenhandler.go index 48844f39..878a536c 100644 --- a/api/internal/handler/storage/dailypowerscreenhandler.go +++ b/api/internal/handler/storage/dailypowerscreenhandler.go @@ -1,28 +1,24 @@ package storage import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storage" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func DailyPowerScreenHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DailyPowerScreenReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := storage.NewDailyPowerScreenLogic(r.Context(), svcCtx) resp, err := l.DailyPowerScreen(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/storage/percentercomputerpowershandler.go b/api/internal/handler/storage/percentercomputerpowershandler.go index 2e1b5f78..15c7d3a1 100644 --- a/api/internal/handler/storage/percentercomputerpowershandler.go +++ b/api/internal/handler/storage/percentercomputerpowershandler.go @@ -1,28 +1,24 @@ package storage import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storage" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func PerCenterComputerPowersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.PerCenterComputerPowersReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := storage.NewPerCenterComputerPowersLogic(r.Context(), svcCtx) resp, err := l.PerCenterComputerPowers(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/storage/screenstoragehandler.go b/api/internal/handler/storage/screenstoragehandler.go index 8a8a2bec..2a6d8901 100644 --- a/api/internal/handler/storage/screenstoragehandler.go +++ b/api/internal/handler/storage/screenstoragehandler.go @@ -1,28 +1,24 @@ package storage import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storage" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ScreenStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.StorageScreenReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := storage.NewScreenStorageLogic(r.Context(), svcCtx) resp, err := l.ScreenStorage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } From 2cc0167361b8cb3e97699ab085bda2b48877292a Mon Sep 17 00:00:00 2001 From: qiwang <1364512070@qq.com> Date: Tue, 26 Mar 2024 15:49:24 +0800 Subject: [PATCH 15/15] feat:Add field to create virtual machine Former-commit-id: 42e3e3d8094f4389fb2f564ae270ccc5c27fedd3 --- api/desc/pcm.api | 4 +++ api/desc/vm/pcm-vm.api | 6 ++-- .../handler/core/commitvmtasktemphandler.go | 28 +++++++++++++++++ api/internal/handler/routes.go | 5 ++++ .../logic/core/commitvmtasktemplogic.go | 30 +++++++++++++++++++ api/internal/types/types.go | 6 ++-- go.mod | 1 + go.sum | 1 + 8 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 api/internal/handler/core/commitvmtasktemphandler.go create mode 100644 api/internal/logic/core/commitvmtasktemplogic.go diff --git a/api/desc/pcm.api b/api/desc/pcm.api index 63fe0d68..b776ef67 100644 --- a/api/desc/pcm.api +++ b/api/desc/pcm.api @@ -42,6 +42,10 @@ service pcm { @handler commitVmTaskHandler post /core/commitVmTask (commitVmTaskReq) returns (commitVmTaskResp) + @doc "提交虚拟机任务临时" + @handler commitVmTaskTempHandler + post /core/commitVmTaskTemp (commitVmTaskReq) returns (commitVmTaskResp) + @doc "删除任务" @handler deleteTaskHandler delete /core/deleteTask/:id (deleteTaskReq) diff --git a/api/desc/vm/pcm-vm.api b/api/desc/vm/pcm-vm.api index fd095a9b..361b86d4 100644 --- a/api/desc/vm/pcm-vm.api +++ b/api/desc/vm/pcm-vm.api @@ -321,7 +321,7 @@ type ( type ( CreateServerReq { Server Server `json:"server" copier:"Server"` - Platform string `form:"platform,optional"` + Platform string `json:"platform,optional"` } CreateServerResp { Server ServerResp `json:"server" copier:"Server"` @@ -748,7 +748,7 @@ type ( type ( CreateNetworkReq { Network CreateNetwork `json:"network" copier:"Network"` - Platform string `form:"platform,optional"` + Platform string `json:"platform,optional"` } CreateNetworkResp { Network Network `json:"network" copier:"Network"` @@ -766,7 +766,7 @@ type ( type ( CreateSubnetReq { Subnet Subnet `json:"subnet" copier:"Subnet"` - Platform string `form:"platform,optional"` + Platform string `json:"platform,optional"` } CreateSubnetResp { Subnet SubnetResp `json:"subnet" copier:"Subnet"` diff --git a/api/internal/handler/core/commitvmtasktemphandler.go b/api/internal/handler/core/commitvmtasktemphandler.go new file mode 100644 index 00000000..6167ba5c --- /dev/null +++ b/api/internal/handler/core/commitvmtasktemphandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CommitVmTaskTempHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CommitVmTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewCommitVmTaskTempLogic(r.Context(), svcCtx) + resp, err := l.CommitVmTaskTemp(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/routes.go b/api/internal/handler/routes.go index 50f31d6c..0fef8992 100644 --- a/api/internal/handler/routes.go +++ b/api/internal/handler/routes.go @@ -44,6 +44,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { Path: "/core/commitVmTask", Handler: core.CommitVmTaskHandler(serverCtx), }, + { + Method: http.MethodPost, + Path: "/core/commitVmTaskTemp", + Handler: core.CommitVmTaskTempHandler(serverCtx), + }, { Method: http.MethodDelete, Path: "/core/deleteTask/:id", diff --git a/api/internal/logic/core/commitvmtasktemplogic.go b/api/internal/logic/core/commitvmtasktemplogic.go new file mode 100644 index 00000000..f9501d46 --- /dev/null +++ b/api/internal/logic/core/commitvmtasktemplogic.go @@ -0,0 +1,30 @@ +package core + +import ( + "context" + + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CommitVmTaskTempLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewCommitVmTaskTempLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommitVmTaskTempLogic { + return &CommitVmTaskTempLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CommitVmTaskTempLogic) CommitVmTaskTemp(req *types.CommitVmTaskReq) (resp *types.CommitVmTaskResp, err error) { + // todo: add your logic here and delete this line + + return +} diff --git a/api/internal/types/types.go b/api/internal/types/types.go index a3bbb150..3ef91338 100644 --- a/api/internal/types/types.go +++ b/api/internal/types/types.go @@ -2871,7 +2871,7 @@ type DeleteServerResp struct { type CreateServerReq struct { Server Server `json:"server" copier:"Server"` - Platform string `form:"platform,optional"` + Platform string `json:"platform,optional"` } type CreateServerResp struct { @@ -3288,7 +3288,7 @@ type DeleteNetworkResp struct { type CreateNetworkReq struct { Network CreateNetwork `json:"network" copier:"Network"` - Platform string `form:"platform,optional"` + Platform string `json:"platform,optional"` } type CreateNetworkResp struct { @@ -3306,7 +3306,7 @@ type CreateNetwork struct { type CreateSubnetReq struct { Subnet Subnet `json:"subnet" copier:"Subnet"` - Platform string `form:"platform,optional"` + Platform string `json:"platform,optional"` } type CreateSubnetResp struct { diff --git a/go.mod b/go.mod index 13dde252..d90c41f9 100644 --- a/go.mod +++ b/go.mod @@ -86,6 +86,7 @@ require ( github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect diff --git a/go.sum b/go.sum index ebd640ab..650a4a3c 100644 --- a/go.sum +++ b/go.sum @@ -815,6 +815,7 @@ github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOj github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/microsoft/go-mssqldb v0.17.0 h1:Fto83dMZPnYv1Zwx5vHHxpNraeEaUlQ/hhHLgZiaenE= github.com/microsoft/go-mssqldb v0.17.0/go.mod h1:OkoNGhGEs8EZqchVTtochlXruEhEOaO4S0d2sB5aeGQ= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=