# Conflicts:
#	api/desc/pcm.api
#	api/internal/handler/core/listdomainresourcehandler.go
#	api/internal/handler/routes.go
#	go.mod
#	go.sum


Former-commit-id: b139679e41885aa91da69cbb61e98a7e84ca4f8d
This commit is contained in:
zhangwei 2024-03-26 17:05:16 +08:00
commit d62c25c4dd
116 changed files with 1075 additions and 1323 deletions

View File

@ -11,31 +11,3 @@ type Task interface {
PushTaskInfo(pushTaskInfoReq PushTaskInfoReq) (*PushTaskInfoResp, error) PushTaskInfo(pushTaskInfoReq PushTaskInfoReq) (*PushTaskInfoResp, error)
PushResourceInfo(pushResourceInfoReq PushResourceInfoReq) 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"`
}

View File

@ -5,6 +5,34 @@ import (
"time" "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 { type HpcInfo struct {
Id int64 `json:"id"` // id Id int64 `json:"id"` // id
TaskId int64 `json:"task_id"` // 任务id TaskId int64 `json:"task_id"` // 任务id

View File

@ -131,7 +131,7 @@ type (
NsID string `json:"nsID"` NsID string `json:"nsID"`
Replicas int64 `json:"replicas,optional"` Replicas int64 `json:"replicas,optional"`
MatchLabels map[string]string `json:"matchLabels,optional"` MatchLabels map[string]string `json:"matchLabels,optional"`
server []ServerCommit `json:"server,optional"` servers []ServerCommit `json:"servers,optional"`
platform string `json:"platform,optional"` platform string `json:"platform,optional"`
} }
ServerCommit { ServerCommit {
@ -548,6 +548,14 @@ type (
Server string `form:"server,optional"` Server string `form:"server,optional"`
PageInfo 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 { AdapterReq {
Id string `json:"id,optional" db:"id"` Id string `json:"id,optional" db:"id"`
Name string `json:"name,optional"` Name string `json:"name,optional"`
@ -687,7 +695,8 @@ type clusterSumReq {
} }
type clusterSumReqResp { type clusterSumReqResp {
ClusterSum int `json:"ClusterSum,omitempty"` PodSum int `json:"podSum,omitempty"`
VmSum int `json:"vmSum,omitempty"`
AdapterSum int `json:"AdapterSum,omitempty"` AdapterSum int `json:"AdapterSum,omitempty"`
TaskSum int `json:"TaskSum,omitempty"` TaskSum int `json:"TaskSum,omitempty"`
} }

View File

@ -23,27 +23,30 @@ type (
Description string `json:"description,optional"` Description string `json:"description,optional"`
tenantId int64 `json:"tenantId,optional"` tenantId int64 `json:"tenantId,optional"`
TaskId int64 `json:"taskId,optional"` TaskId int64 `json:"taskId,optional"`
participantId int64 `json:"participantId,optional"` AdapterId int64 `json:"adapterId,optional"`
matchLabels map[string]string `json:"matchLabels,optional"` MatchLabels map[string]string `json:"matchLabels,optional"`
cardCount int64 `json:"cardCount,optional"` CardCount int64 `json:"cardCount,optional"`
workDir string `json:"workDir,optional"` //paratera:workingDir WorkDir string `json:"workDir,optional"` //paratera:workingDir
wallTime string `json:"wallTime,optional"` WallTime string `json:"wallTime,optional"`
cmdScript string `json:"cmdScript,optional"` // paratera:bootScript CmdScript string `json:"cmdScript,optional"` // paratera:bootScript
appType string `json:"appType,optional"` AppType string `json:"appType,optional"`
appName string `json:"appName,optional"` // paratera:jobGroupName ac:appname AppName string `json:"appName,optional"` // paratera:jobGroupName ac:appname
queue string `json:"queue,optional"` Queue string `json:"queue,optional"`
nNode string `json:"nNode,optional"` NNode string `json:"nNode,optional"`
submitType string `json:"submitType,optional"` SubmitType string `json:"submitType,optional"`
stdOutFile string `json:"stdOutFile,optional"` StdOutFile string `json:"stdOutFile,optional"`
stdErrFile string `json:"stdErrFile,optional"` StdErrFile string `json:"stdErrFile,optional"`
stdInput string `json:"stdInput,optional"` StdInput string `json:"stdInput,optional"`
environment map[string]string `json:"environment,optional"` Environment map[string]string `json:"environment,optional"`
ClusterType string `json:"clusterType,optional"`
} }
) )
type ( type (
commitHpcTaskResp { commitHpcTaskResp {
TaskId int64 `json:"taskId"` TaskId int64 `json:"taskId"`
Code int32 `json:"code"`
Msg string `json:"msg"`
} }
) )

View File

@ -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 `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"`
}

View File

@ -9,6 +9,7 @@ import (
"cloud/pcm-cloud.api" "cloud/pcm-cloud.api"
"storelink/pcm-storelink.api" "storelink/pcm-storelink.api"
"schedule/pcm-schedule.api" "schedule/pcm-schedule.api"
"participant/pcm-participant.api"
) )
info( info(
@ -41,6 +42,10 @@ service pcm {
@handler commitVmTaskHandler @handler commitVmTaskHandler
post /core/commitVmTask (commitVmTaskReq) returns (commitVmTaskResp) post /core/commitVmTask (commitVmTaskReq) returns (commitVmTaskResp)
@doc "提交虚拟机任务临时"
@handler commitVmTaskTempHandler
post /core/commitVmTaskTemp (commitVmTaskReq) returns (commitVmTaskResp)
@doc "删除任务" @doc "删除任务"
@handler deleteTaskHandler @handler deleteTaskHandler
delete /core/deleteTask/:id (deleteTaskReq) delete /core/deleteTask/:id (deleteTaskReq)
@ -109,6 +114,14 @@ service pcm {
@handler metricsHandler @handler metricsHandler
get /core/metrics 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)
@doc "alert rules" @doc "alert rules"
@handler alertRulesHandler @handler alertRulesHandler
get /core/alert/rules get /core/alert/rules
@ -855,7 +868,7 @@ service pcm {
get /adapter/cluster/get (FId) returns (ClusterResp) get /adapter/cluster/get (FId) returns (ClusterResp)
@handler GetAdapterRelationHandler @handler GetAdapterRelationHandler
get /adapter/relation (AdapterQueryReq) returns (PageResult) get /adapter/relation (AdapterRelationQueryReq) returns (PageResult)
@handler GetClusterSumHandler @handler GetClusterSumHandler
get /adapter/clusterSum (clusterSumReq) returns (clusterSumReqResp) get /adapter/clusterSum (clusterSumReq) returns (clusterSumReqResp)

View File

@ -36,7 +36,7 @@ type (
absolute Absolute `json:"absolute,optional"` absolute Absolute `json:"absolute,optional"`
} }
GetComputeLimitsReq { GetComputeLimitsReq {
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
GetComputeLimitsResp { GetComputeLimitsResp {
@ -66,7 +66,7 @@ type (
absolute VolumeAbsolute `json:"absolute,optional"` absolute VolumeAbsolute `json:"absolute,optional"`
} }
GetVolumeLimitsReq { GetVolumeLimitsReq {
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
GetVolumeLimitsResp { GetVolumeLimitsResp {
@ -81,7 +81,7 @@ type (
ListServersReq { ListServersReq {
Limit int32 `form:"limit,optional"` Limit int32 `form:"limit,optional"`
OffSet int32 `form:"offSet,optional"` OffSet int32 `form:"offSet,optional"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
ListServersResp { ListServersResp {
TotalNumber uint32 `json:"totalNumber" copier:"TotalNumber"` TotalNumber uint32 `json:"totalNumber" copier:"TotalNumber"`
@ -111,7 +111,7 @@ type (
type ( type (
ListServersDetailedReq { ListServersDetailedReq {
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
ListServersDetailedResp { ListServersDetailedResp {
ServersDetailed []ServersDetailed `json:"servers" copier:"ServersDetailed"` ServersDetailed []ServersDetailed `json:"servers" copier:"ServersDetailed"`
@ -137,7 +137,7 @@ type (
type( type(
GetServersDetailedByIdReq{ GetServersDetailedByIdReq{
ServerId string `form:"server_id" copier:"ServerId"` ServerId string `form:"server_id" copier:"ServerId"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
GetServersDetailedByIdResp{ GetServersDetailedByIdResp{
@ -222,7 +222,7 @@ type(
UpdateServerReq{ UpdateServerReq{
ServerId string `form:"server_id" copier:"ServerId"` ServerId string `form:"server_id" copier:"ServerId"`
ServerUpdate ServerUpdate `json:"server_update" copier:"ServerUpdate"` ServerUpdate ServerUpdate `json:"server_update" copier:"ServerUpdate"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
ServerUpdate{ ServerUpdate{
Server Server `json:"server" copier:"Server"` Server Server `json:"server" copier:"Server"`
@ -239,7 +239,7 @@ type (
ServerId string `json:"server_id" copier:"ServerId"` ServerId string `json:"server_id" copier:"ServerId"`
Action []map[string]string `json:"action,optional" copier:"Action"` Action []map[string]string `json:"action,optional" copier:"Action"`
start_action string `json:"start_action" copier:"start_action"` start_action string `json:"start_action" copier:"start_action"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
StartServerResp { StartServerResp {
Msg string `json:"msg,omitempty"` Msg string `json:"msg,omitempty"`
@ -253,19 +253,20 @@ type(
ServerId string `json:"server_id" copier:"ServerId"` ServerId string `json:"server_id" copier:"ServerId"`
Action []map[string]string `json:"action,optional" copier:"Action"` Action []map[string]string `json:"action,optional" copier:"Action"`
stop_action string `json:"stop_action" copier:"stop_action"` stop_action string `json:"stop_action" copier:"stop_action"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
StopServerResp { StopServerResp {
Msg string `json:"msg,omitempty"` Msg string `json:"msg,omitempty"`
ErrorMsg string `json:"errorMsg,omitempty"` ErrorMsg string `json:"errorMsg,omitempty"`
Code int32 `json:"code,omitempty"` } Code int32 `json:"code,omitempty"`
}
) )
type( type(
RebootServerReq{ RebootServerReq{
ServerId string `json:"server_id" copier:"ServerId"` ServerId string `json:"server_id" copier:"ServerId"`
Reboot Reboot `json:"reboot" copier:"Reboot"` Reboot Reboot `json:"reboot" copier:"Reboot"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
RebootServerResp { RebootServerResp {
Msg string `json:"msg,omitempty"` Msg string `json:"msg,omitempty"`
@ -281,7 +282,7 @@ type(
ServerId string `json:"server_id" copier:"ServerId"` ServerId string `json:"server_id" copier:"ServerId"`
Action []map[string]string `json:"Action,optional" copier:"Action"` Action []map[string]string `json:"Action,optional" copier:"Action"`
pause_action string `json:"pause_action" copier:"pause_action"` pause_action string `json:"pause_action" copier:"pause_action"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
PauseServerResp { PauseServerResp {
Msg string `json:"msg,omitempty"` Msg string `json:"msg,omitempty"`
@ -295,7 +296,7 @@ type(
ServerId string `json:"server_id" copier:"ServerId"` ServerId string `json:"server_id" copier:"ServerId"`
Action []map[string]string `json:"Action,optional" copier:"Action"` Action []map[string]string `json:"Action,optional" copier:"Action"`
unpause_action string `json:"unpause_action" copier:"unpause_action"` unpause_action string `json:"unpause_action" copier:"unpause_action"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
UnpauseServerResp { UnpauseServerResp {
Msg string `json:"msg,omitempty"` Msg string `json:"msg,omitempty"`
@ -307,7 +308,7 @@ type(
type ( type (
DeleteServerReq { DeleteServerReq {
ServerId string `form:"server_id" copier:"ServerId"` ServerId string `form:"server_id" copier:"ServerId"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
DeleteServerResp { DeleteServerResp {
@ -329,12 +330,15 @@ type (
ErrorMsg string `json:"errorMsg,omitempty"` ErrorMsg string `json:"errorMsg,omitempty"`
} }
Server { Server {
AvailabilityZone string `json:"availability_zone" copier:"AvailabilityZone"`
Name string `json:"name,optional" copier:"Name"` Name string `json:"name,optional" copier:"Name"`
FlavorRef string `json:"flavorRef,optional" copier:"FlavorRef"` FlavorRef string `json:"flavorRef,optional" copier:"FlavorRef"`
Description string `json:"description,optional" copier:"Description"`
ImageRef string `json:"imageRef,optional" copier:"ImageRef"` ImageRef string `json:"imageRef,optional" copier:"ImageRef"`
Networks []CreNetwork `json:"networks,optional" copier:"Networks"` Networks []CreNetwork `json:"networks,optional" copier:"Networks"`
//AdminPass string `json:"adminPass" copier:"AdminPass"` //AdminPass string `json:"adminPass" copier:"AdminPass"`
BlockDeviceMappingV2 []Block_device_mapping_v2 `json:"block_device_mapping_v2,optional" copier:"BlockDeviceMappingV2"` BlockDeviceMappingV2 []Block_device_mapping_v2 `json:"block_device_mapping_v2,optional" copier:"BlockDeviceMappingV2"`
MinCount int32 `json:"min_count,optional" copier:"MinCount"`
} }
CreNetwork { CreNetwork {
Uuid string `json:"uuid" copier:"Uuid"` Uuid string `json:"uuid" copier:"Uuid"`
@ -361,7 +365,7 @@ type (
type( type(
RebuildServerReq{ RebuildServerReq{
ServerId string `json:"server_id" copier:"ServerId"` ServerId string `json:"server_id" copier:"ServerId"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
Rebuild Rebuild `json:"rebuild" copier:"Rebuild"` Rebuild Rebuild `json:"rebuild" copier:"Rebuild"`
} }
RebuildServerResp { RebuildServerResp {
@ -435,7 +439,7 @@ type(
ServerId string `json:"server_id" copier:"ServerId"` ServerId string `json:"server_id" copier:"ServerId"`
Action []map[string]string `json:"Action,optional" copier:"Action"` Action []map[string]string `json:"Action,optional" copier:"Action"`
shelve_action string `json:"shelve_action" copier:"shelve_action"` shelve_action string `json:"shelve_action" copier:"shelve_action"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
ShelveServerResp { ShelveServerResp {
Msg string `json:"msg,omitempty"` Msg string `json:"msg,omitempty"`
@ -447,7 +451,7 @@ type(
type( type(
RescueServerReq{ RescueServerReq{
ServerId string `json:"server_id" copier:"ServerId"` ServerId string `json:"server_id" copier:"ServerId"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
Rescue Rescue `json:"rescue" copier:"Rescue"` Rescue Rescue `json:"rescue" copier:"Rescue"`
} }
RescueServerResp { RescueServerResp {
@ -465,7 +469,7 @@ type(
UnRescueServerReq{ UnRescueServerReq{
ServerId string `json:"server_id" copier:"ServerId"` ServerId string `json:"server_id" copier:"ServerId"`
Action []map[string]string `json:"Action,optional" copier:"Action"` 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"` UnRescue_action string `json:"UnRescue_action" copier:"UnRescue_action"`
Rescue Rescue `json:"rescue" copier:"Rescue"` Rescue Rescue `json:"rescue" copier:"Rescue"`
} }
@ -480,7 +484,7 @@ type(
ChangeAdministrativePasswordReq{ ChangeAdministrativePasswordReq{
ServerId string `json:"server_id" copier:"ServerId"` ServerId string `json:"server_id" copier:"ServerId"`
Changepassword string `json:"changePassword" copier:"Changepassword"` Changepassword string `json:"changePassword" copier:"Changepassword"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
ChangePassword ChangePassword `json:"changepassword" copier:"ChangePassword"` ChangePassword ChangePassword `json:"changepassword" copier:"ChangePassword"`
} }
ChangeAdministrativePasswordResp { ChangeAdministrativePasswordResp {
@ -497,7 +501,7 @@ type(
SuspendServerReq{ SuspendServerReq{
ServerId string `json:"server_id" copier:"ServerId"` ServerId string `json:"server_id" copier:"ServerId"`
Action []map[string]string `json:"Action,optional" copier:"Action"` 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"` UnRescue_action string `json:"UnRescue_action" copier:"UnRescue_action"`
Rescue Rescue `json:"rescue" copier:"Rescue"` Rescue Rescue `json:"rescue" copier:"Rescue"`
} }
@ -512,7 +516,7 @@ type(
AddSecurityGroupToServerReq{ AddSecurityGroupToServerReq{
ServerId string `json:"server_id" copier:"ServerId"` ServerId string `json:"server_id" copier:"ServerId"`
Action []map[string]string `json:"Action,optional" copier:"Action"` 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"` UnRescue_action string `json:"UnRescue_action" copier:"UnRescue_action"`
AddSecurityGroup AddSecurityGroup `json:"addSecurityGroup" copier:"AddSecurityGroup"` AddSecurityGroup AddSecurityGroup `json:"addSecurityGroup" copier:"AddSecurityGroup"`
} }
@ -529,7 +533,7 @@ type(
type( type(
removeSecurityGroupReq{ removeSecurityGroupReq{
ServerId string `json:"server_id" copier:"ServerId"` ServerId string `json:"server_id" copier:"ServerId"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
RemoveSecurityGroup RemoveSecurityGroup `json:"removeSecurityGroup" copier:"RemoveSecurityGroup"` RemoveSecurityGroup RemoveSecurityGroup `json:"removeSecurityGroup" copier:"RemoveSecurityGroup"`
} }
removeSecurityGroupResp { removeSecurityGroupResp {
@ -565,7 +569,7 @@ type(
type( type(
DeleteFlavorReq{ DeleteFlavorReq{
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
ServerId string `json:"server_id" copier:"ServerId"` ServerId string `json:"server_id" copier:"ServerId"`
FlavorId string `json:"flavor_id" copier:"FlavorId"` FlavorId string `json:"flavor_id" copier:"FlavorId"`
} }
@ -581,8 +585,7 @@ type(
/******************find images end*************************/ /******************find images end*************************/
type ( type (
ListImagesReq { ListImagesReq {
Limit int32 `form:"limit,optional"` Platform string `form:"platform,optional"`
Platform string `json:"platform,optional"`
} }
ListImagesResp { ListImagesResp {
First string `json:"first" copier:"First"` First string `json:"first" copier:"First"`
@ -651,7 +654,7 @@ type (
type ( type (
UploadOsImageReq { UploadOsImageReq {
ImageId string `form:"image_id" copier:"ImageId"` ImageId string `form:"image_id" copier:"ImageId"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
UploadOsImageResp { UploadOsImageResp {
Code int32 `json:"code,omitempty" copier:"Code"` Code int32 `json:"code,omitempty" copier:"Code"`
@ -663,7 +666,7 @@ type (
type ( type (
DeleteImageReq { DeleteImageReq {
ImageId string `form:"image_id" copier:"ImageId"` ImageId string `form:"image_id" copier:"ImageId"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
DeleteImageResp { DeleteImageResp {
Code int32 `json:"code,omitempty"` Code int32 `json:"code,omitempty"`
@ -695,7 +698,7 @@ type (
type ( type (
ListNetworksReq { ListNetworksReq {
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
ListNetworksResp { ListNetworksResp {
Networks []Network `json:"networks" copier:"Networks"` Networks []Network `json:"networks" copier:"Networks"`
@ -714,7 +717,7 @@ type (
Ipv6AddressScope string `json:"ipv6_address_scope,optional" copier:"Ipv6AddressScope"` Ipv6AddressScope string `json:"ipv6_address_scope,optional" copier:"Ipv6AddressScope"`
L2Adjacency bool `json:"l2_adjacency,optional" copier:"L2Adjacency"` L2Adjacency bool `json:"l2_adjacency,optional" copier:"L2Adjacency"`
Mtu int64 `json:"mtu,optional" copier:"Mtu"` 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"` PortSecurityEnabled bool `json:"port_security_enabled,optional" copier:"PortSecurityEnabled"`
ProjectId string `json:"project_id,optional" copier:"ProjectId"` ProjectId string `json:"project_id,optional" copier:"ProjectId"`
QosPolicyId string `json:"qos_policy_id,optional" copier:"QosPolicyId"` QosPolicyId string `json:"qos_policy_id,optional" copier:"QosPolicyId"`
@ -734,7 +737,7 @@ type (
type ( type (
DeleteNetworkReq { DeleteNetworkReq {
NetworkId string `form:"network_id" copier:"NetworkId"` NetworkId string `form:"network_id" copier:"NetworkId"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
DeleteNetworkResp { DeleteNetworkResp {
Code int32 `json:"code,omitempty" copier:"Code"` Code int32 `json:"code,omitempty" copier:"Code"`
@ -816,7 +819,7 @@ type (
type( type(
ShowNetworkDetailsReq{ ShowNetworkDetailsReq{
NetworkId string `form:"network_id" copier:"NetworkId"` NetworkId string `form:"network_id" copier:"NetworkId"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
ShowNetworkDetailsResp{ ShowNetworkDetailsResp{
Network Networkdetail `json:"network" copier:"Network"` Network Networkdetail `json:"network" copier:"Network"`
@ -855,7 +858,7 @@ type(
UpdateNetworkReq { UpdateNetworkReq {
NetworkId string `form:"network_id" copier:"NetworkId"` NetworkId string `form:"network_id" copier:"NetworkId"`
Network Network `json:"network" copier:"Network"` Network Network `json:"network" copier:"Network"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
UpdateNetworkResp { UpdateNetworkResp {
Network Network `json:"network" copier:"Network"` Network Network `json:"network" copier:"Network"`
@ -882,7 +885,7 @@ type(
ListSubnetsReq { ListSubnetsReq {
Limit int32 `json:"limit,optional"` Limit int32 `json:"limit,optional"`
OffSet int32 `json:"offSet,optional"` OffSet int32 `json:"offSet,optional"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
ListSubnetsResp { ListSubnetsResp {
Subnets []Subnets `json:"subnets" copier:"Subnets"` Subnets []Subnets `json:"subnets" copier:"Subnets"`
@ -923,7 +926,7 @@ type(
type( type(
DeleteSubnetReq{ DeleteSubnetReq{
subnetId string `json:"subnet_id,optional" copier:"subnetId"` subnetId string `json:"subnet_id,optional" copier:"subnetId"`
Platform string `json:"platform,optional" copier:"Platform"` Platform string `form:"platform,optional" copier:"Platform"`
} }
DeleteSubnetResp{ DeleteSubnetResp{
Code int32 `json:"code,omitempty" copier:"Code"` Code int32 `json:"code,omitempty" copier:"Code"`
@ -935,7 +938,7 @@ type(
type( type(
UpdateSubnetReq{ UpdateSubnetReq{
subnetId string `json:"subnet_id,optional" copier:"subnetId"` subnetId string `json:"subnet_id,optional" copier:"subnetId"`
Platform string `json:"platform,optional" copier:"Platform"` Platform string `form:"platform,optional" copier:"Platform"`
} }
UpdateSubnetResp{ UpdateSubnetResp{
Code int32 `json:"code,omitempty" copier:"Code"` Code int32 `json:"code,omitempty" copier:"Code"`
@ -980,7 +983,7 @@ type (
ListNetworkSegmentRangesReq{ ListNetworkSegmentRangesReq{
Limit int32 `json:"limit,optional"` Limit int32 `json:"limit,optional"`
OffSet int32 `json:"offSet,optional"` OffSet int32 `json:"offSet,optional"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
ListNetworkSegmentRangesResp{ ListNetworkSegmentRangesResp{
@ -1012,7 +1015,7 @@ type (
type( type(
DeleteNetworkSegmentRangesReq{ DeleteNetworkSegmentRangesReq{
network_segment_range_id string `json:"network_segment_range_id,optional" copier:"network_segment_range_id"` 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{ DeleteNetworkSegmentRangesResp{
Code int32 `json:"code,omitempty" copier:"Code"` Code int32 `json:"code,omitempty" copier:"Code"`
@ -1025,7 +1028,7 @@ type(
UpdateNetworkSegmentRangesReq{ UpdateNetworkSegmentRangesReq{
network_segment_range_id string `json:"network_segment_range_id,optional" copier:"network_segment_range_id"` 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"` 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{ UpdateNetworkSegmentRangesResp{
NetworkSegmentRange Network_segment_range `json:"network_segment_range,optional" copier:"NetworkSegmentRange"` NetworkSegmentRange Network_segment_range `json:"network_segment_range,optional" copier:"NetworkSegmentRange"`
@ -1099,7 +1102,7 @@ type (
ListPortsReq{ ListPortsReq{
Limit int32 `json:"limit,optional"` Limit int32 `json:"limit,optional"`
OffSet int32 `json:"offSet,optional"` OffSet int32 `json:"offSet,optional"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
ListPortsResp{ ListPortsResp{
ports []PortLists `json:"ports,optional" copier:"ports"` ports []PortLists `json:"ports,optional" copier:"ports"`
@ -1155,7 +1158,7 @@ type (
type( type(
DeletePortReq{ DeletePortReq{
port_id string `json:"port_id,optional" copier:"port_id"` 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{ DeletePortResp{
Code int32 `json:"code,omitempty" copier:"Code"` Code int32 `json:"code,omitempty" copier:"Code"`
@ -1168,7 +1171,7 @@ type(
UpdatePortReq{ UpdatePortReq{
port_id string `json:"port_id,optional" copier:"port_id"` port_id string `json:"port_id,optional" copier:"port_id"`
port Port `json:"port,optional" copier:"port"` port Port `json:"port,optional" copier:"port"`
platform string `json:"platform,optional" copier:"platform"` platform string `form:"platform,optional" copier:"platform"`
} }
UpdatePortResp{ UpdatePortResp{
port Port `json:"port,optional" copier:"port"` port Port `json:"port,optional" copier:"port"`
@ -1182,7 +1185,7 @@ type(
ShowPortDetailsReq{ ShowPortDetailsReq{
port_id string `json:"port_id,optional" copier:"port_id"` port_id string `json:"port_id,optional" copier:"port_id"`
fields string `json:"fields,optional" copier:"fields"` fields string `json:"fields,optional" copier:"fields"`
platform string `json:"platform,optional" copier:"platform"` platform string `form:"platform,optional" copier:"platform"`
} }
ShowPortDetailsResp{ ShowPortDetailsResp{
port Port `json:"port,optional" copier:"port"` port Port `json:"port,optional" copier:"port"`
@ -1197,7 +1200,7 @@ type(
ListRoutersReq{ ListRoutersReq{
Limit int32 `json:"limit,optional"` Limit int32 `json:"limit,optional"`
OffSet int32 `json:"offSet,optional"` OffSet int32 `json:"offSet,optional"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
ListRoutersResp{ ListRoutersResp{
routers []Routers `json:"routers,optional" copier:"routers"` routers []Routers `json:"routers,optional" copier:"routers"`
@ -1288,7 +1291,7 @@ type(
type( type(
UpdateRouterReq{ UpdateRouterReq{
router Router `json:"router,optional" copier:"router"` router Router `json:"router,optional" copier:"router"`
Platform string `json:"platform,optional" copier:"Platform"` Platform string `form:"platform,optional" copier:"Platform"`
} }
UpdateRouterResp{ UpdateRouterResp{
@ -1302,7 +1305,7 @@ type(
type( type(
ShowRouterDetailsReq{ ShowRouterDetailsReq{
router Router `json:"router,optional" copier:"router"` router Router `json:"router,optional" copier:"router"`
Platform string `json:"platform,optional" copier:"Platform"` Platform string `form:"platform,optional" copier:"Platform"`
} }
ShowRouterDetailsResp{ ShowRouterDetailsResp{
@ -1315,7 +1318,7 @@ type(
type( type(
DeleteRouterReq{ 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"` router_id string `json:"router_id,optional" copier:"router_id"`
} }
DeleteRouterResp{ DeleteRouterResp{
@ -1328,7 +1331,7 @@ type(
//浮动IPs //浮动IPs
type( type(
ListFloatingIPsReq{ ListFloatingIPsReq{
Platform string `json:"platform,optional" copier:"Platform"` Platform string `form:"platform,optional" copier:"Platform"`
Limit int32 `json:"limit,optional" copier:"Limit"` Limit int32 `json:"limit,optional" copier:"Limit"`
OffSet int32 `json:"offSet,optional" copier:"OffSet"` OffSet int32 `json:"offSet,optional" copier:"OffSet"`
} }
@ -1413,7 +1416,7 @@ type(
type ( type (
UpdateFloatingIPReq{ 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_id string `json:"floatingip_id,optional" copier:"floatingip_id"`
floatingip Floatingip `json:"floatingip,optional" copier:"floatingip"` floatingip Floatingip `json:"floatingip,optional" copier:"floatingip"`
} }
@ -1427,7 +1430,7 @@ type (
type ( type (
DeleteFloatingIPReq{ 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"` floatingip_id string `json:"floatingip_id,optional" copier:"floatingip_id"`
} }
DeleteFloatingIPResp{ DeleteFloatingIPResp{
@ -1453,7 +1456,7 @@ type (
//firewall //firewall
type ( type (
ListFirewallGroupsReq{ ListFirewallGroupsReq{
Platform string `json:"platform,optional" copier:"Platform"` Platform string `form:"platform,optional" copier:"Platform"`
fields string `json:"fields,optional" copier:"fields"` fields string `json:"fields,optional" copier:"fields"`
} }
ListFirewallGroupsResp{ ListFirewallGroupsResp{
@ -1480,7 +1483,7 @@ type (
type( type(
DeleteFirewallGroupReq { DeleteFirewallGroupReq {
firewall_group_id string `json:"firewall_group_id,optional" copier:"firewall_group_id"` 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 { DeleteFirewallGroupResp {
Code int32 `json:"code,omitempty" copier:"Code"` Code int32 `json:"code,omitempty" copier:"Code"`
@ -1518,7 +1521,7 @@ type(
type ( type (
UpdateFirewallGroupReq{ UpdateFirewallGroupReq{
firewall_group Firewall_group `json:"firewall_group,optional" copier:"firewall_group"` 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"` firewall_group_id string `json:"firewall_group_id,optional" copier:"firewall_group_id"`
} }
UpdateFirewallGroupResp{ UpdateFirewallGroupResp{
@ -1531,7 +1534,7 @@ type (
type ( type (
ShowFirewallGroupDetailsReq{ 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"` firewall_group_id string `json:"firewall_group_id,optional" copier:"firewall_group_id"`
} }
ShowFirewallGroupDetailsResp{ ShowFirewallGroupDetailsResp{
@ -1567,7 +1570,7 @@ type(
type( type(
DeleteFirewallPolicyReq{ 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"` firewall_policy_id string `json:"firewall_policy_id,optional" copier:"firewall_policy_id"`
} }
DeleteFirewallPolicyResp{ DeleteFirewallPolicyResp{
@ -1579,7 +1582,7 @@ type(
type( type(
ListFirewallPoliciesReq{ ListFirewallPoliciesReq{
Platform string `json:"platform,optional" copier:"Platform"` Platform string `form:"platform,optional" copier:"Platform"`
fields string `json:"fields,optional" copier:"fields"` fields string `json:"fields,optional" copier:"fields"`
} }
ListFirewallPoliciesResp{ ListFirewallPoliciesResp{
@ -1647,7 +1650,7 @@ type(
type ( type (
DeleteFirewallRuleReq{ 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"` firewall_rule_id string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"`
} }
DeleteFirewallRuleResp{ DeleteFirewallRuleResp{
@ -1659,7 +1662,7 @@ type (
type ( type (
ListFirewallRulesReq{ ListFirewallRulesReq{
Platform string `json:"platform,optional" copier:"Platform"` Platform string `form:"platform,optional" copier:"Platform"`
fields string `json:"fields,optional" copier:"fields"` fields string `json:"fields,optional" copier:"fields"`
} }
ListFirewallRulesResp{ ListFirewallRulesResp{
@ -1690,7 +1693,7 @@ type (
type ( type (
ShowFirewallRuleDetailsReq{ 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"` firewall_rule_id string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"`
} }
ShowFirewallRuleDetailsResp{ ShowFirewallRuleDetailsResp{
@ -1704,7 +1707,7 @@ type (
//Security Group //Security Group
type ( type (
ListSecurityGroupsReq{ 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"` fields string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"`
} }
ListSecurityGroupsResp{ ListSecurityGroupsResp{
@ -1730,7 +1733,7 @@ type (
type ( type (
CreateSecurityGroupReq{ 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"` firewall_rule_id string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"`
} }
CreateSecurityGroupResp{ CreateSecurityGroupResp{
@ -1776,7 +1779,7 @@ type (
type( type(
DeleteSecurityGroupReq{ 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"` security_group_id string `json:"security_group_id,optional" copier:"security_group_id"`
} }
DeleteSecurityGroupResp{ DeleteSecurityGroupResp{
@ -1788,7 +1791,7 @@ type(
type( type(
UpdateSecurityGroupReq{ 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"` security_group_id string `json:"security_group_id,optional" copier:"security_group_id"`
} }
UpdateSecurityGroupResp{ UpdateSecurityGroupResp{
@ -1802,7 +1805,7 @@ type(
type( type(
ShowSecurityGroupReq{ 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"` security_group_id string `json:"security_group_id,optional" copier:"security_group_id"`
fields string `json:"fields,optional" copier:"fields"` fields string `json:"fields,optional" copier:"fields"`
verbose string `json:"verbose,optional" copier:"verbose"` verbose string `json:"verbose,optional" copier:"verbose"`
@ -1818,7 +1821,7 @@ type(
//SecurityGroupRules //SecurityGroupRules
type( type(
ListSecurityGroupRulesReq{ ListSecurityGroupRulesReq{
Platform string `json:"platform,optional" copier:"Platform"` Platform string `form:"platform,optional" copier:"Platform"`
} }
ListSecurityGroupRulesResp{ ListSecurityGroupRulesResp{
Code int32 `json:"code,omitempty" copier:"Code"` Code int32 `json:"code,omitempty" copier:"Code"`
@ -1861,7 +1864,7 @@ type(
type( type(
ShowSecurityGroupRuleReq{ 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"` security_group_rule_id string `json:"security_group_rule_id,optional" copier:"security_group_rule_id"`
} }
ShowSecurityGroupRuleResp{ ShowSecurityGroupRuleResp{
@ -1874,7 +1877,7 @@ type(
type( type(
DeleteSecurityGroupRuleReq{ 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"` security_group_rule_id string `json:"security_group_rule_id,optional" copier:"security_group_rule_id"`
} }
DeleteSecurityGroupRuleResp{ DeleteSecurityGroupRuleResp{
@ -1890,7 +1893,7 @@ type(
/******************find ListVolumesDetail start*************************/ /******************find ListVolumesDetail start*************************/
type ( type (
ListVolumesDetailReq { ListVolumesDetailReq {
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
ListVolumesDetailResp { ListVolumesDetailResp {
VolumeDetail []VolumeDetail `json:"volumes" copier:"VolumeDetail"` VolumeDetail []VolumeDetail `json:"volumes" copier:"VolumeDetail"`
@ -1925,7 +1928,7 @@ type (
VolumeId string `form:"volume_id" copier:"VolumeId"` VolumeId string `form:"volume_id" copier:"VolumeId"`
Cascade bool `json:"cascade" copier:"Cascade"` Cascade bool `json:"cascade" copier:"Cascade"`
Force bool `json:"force" copier:"force"` Force bool `json:"force" copier:"force"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
DeleteVolumeResp { DeleteVolumeResp {
Code int32 `json:"code,omitempty" copier:"Code"` Code int32 `json:"code,omitempty" copier:"Code"`
@ -1976,7 +1979,7 @@ type (
) )
type ( type (
ListVolumeTypesReq { ListVolumeTypesReq {
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
ListVolumeTypesResp { ListVolumeTypesResp {
VolumeTypes []Volume_types `json:"volume_types" copier:"VolumeTypes"` VolumeTypes []Volume_types `json:"volume_types" copier:"VolumeTypes"`
@ -2002,7 +2005,7 @@ type(
UpdateVolumeReq { UpdateVolumeReq {
Volume Volume `json:"volume" copier:"Volume"` Volume Volume `json:"volume" copier:"Volume"`
VolumeId string `json:"volume_id" copier:"VolumeId"` VolumeId string `json:"volume_id" copier:"VolumeId"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
UpdateVolumeResp { UpdateVolumeResp {
Volume Volume `json:"volume" copier:"Volume"` Volume Volume `json:"volume" copier:"Volume"`
@ -2015,7 +2018,7 @@ type(
type( type(
GetVolumeDetailedByIdReq { GetVolumeDetailedByIdReq {
VolumeId string `form:"volume_id" copier:"VolumeId"` VolumeId string `form:"volume_id" copier:"VolumeId"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
GetVolumeDetailedByIdResp { GetVolumeDetailedByIdResp {
Volume VolumeDetailed `json:"volume" copier:"Volume"` Volume VolumeDetailed `json:"volume" copier:"Volume"`
@ -2067,7 +2070,7 @@ type(
type( type(
DeleteVolumeTypeReq { DeleteVolumeTypeReq {
VolumeTypeId string `json:"volume_type_id" copier:"VolumeTypeId"` VolumeTypeId string `json:"volume_type_id" copier:"VolumeTypeId"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
DeleteVolumeTypeResp { DeleteVolumeTypeResp {
Code int32 `json:"code,omitempty" copier:"Code"` Code int32 `json:"code,omitempty" copier:"Code"`
@ -2087,7 +2090,7 @@ type(
CreatedAt string `json:"created_at" copier:"CreatedAt"` CreatedAt string `json:"created_at" copier:"CreatedAt"`
ConsumesQuota bool `json:"consumes_quota" copier:"ConsumesQuota"` ConsumesQuota bool `json:"consumes_quota" copier:"ConsumesQuota"`
UpdatedAt string `json:"updated_at" copier:"UpdatedAt"` UpdatedAt string `json:"updated_at" copier:"UpdatedAt"`
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
ListVolumesResp { ListVolumesResp {
Volumes []VolumesList `json:"volumes" copier:"Volumes"` Volumes []VolumesList `json:"volumes" copier:"Volumes"`
@ -2106,7 +2109,7 @@ type(
type ( type (
ListFlavorsDetailReq { ListFlavorsDetailReq {
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
} }
ListFlavorsDetailResp { ListFlavorsDetailResp {
@ -2133,7 +2136,7 @@ type (
/******************Bare Metal start*************************/ /******************Bare Metal start*************************/
type( type(
ListNodesReq { ListNodesReq {
Platform string `json:"platform,optional"` Platform string `form:"platform,optional"`
Limit int64 `json:"limit" copier:"Limit"` Limit int64 `json:"limit" copier:"Limit"`
Marker string `json:"marker" copier:"Marker"` Marker string `json:"marker" copier:"Marker"`
SortDir string `json:"sort_dir" copier:"SortDir"` SortDir string `json:"sort_dir" copier:"SortDir"`

View File

@ -76,9 +76,9 @@ OpenstackRpcConf:
# core rpc # core rpc
PcmCoreRpcConf: PcmCoreRpcConf:
target: nacos://10.206.0.12:8848/pcm.core.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api # target: nacos://10.206.0.12:8848/pcm.core.rpc?timeout=30s&namespaceid=test&groupname=DEFAULT_GROUP&appName=pcm.core.api
# Endpoints: Endpoints:
# - 127.0.0.1:8888 - pcm-core-rpc:2004
NonBlock: true NonBlock: true
Timeout: 20000 Timeout: 20000

View File

@ -11,7 +11,7 @@ import (
func GetAdapterRelationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { func GetAdapterRelationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.AdapterQueryReq var req types.AdapterRelationQueryReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err) result.ParamErrorResult(r, w, err)
return return

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func CreateAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateAlgorithmReq var req types.CreateAlgorithmReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewCreateAlgorithmLogic(r.Context(), svcCtx) l := ai.NewCreateAlgorithmLogic(r.Context(), svcCtx)
resp, err := l.CreateAlgorithm(&req) resp, err := l.CreateAlgorithm(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func CreateDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateDataSetReq var req types.CreateDataSetReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewCreateDataSetLogic(r.Context(), svcCtx) l := ai.NewCreateDataSetLogic(r.Context(), svcCtx)
resp, err := l.CreateDataSet(&req) resp, err := l.CreateDataSet(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func CreateExportTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateExportTaskReq var req types.CreateExportTaskReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewCreateExportTaskLogic(r.Context(), svcCtx) l := ai.NewCreateExportTaskLogic(r.Context(), svcCtx)
resp, err := l.CreateExportTask(&req) resp, err := l.CreateExportTask(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func CreateNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateNotebookReq var req types.CreateNotebookReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewCreateNotebookLogic(r.Context(), svcCtx) l := ai.NewCreateNotebookLogic(r.Context(), svcCtx)
resp, err := l.CreateNotebook(&req) resp, err := l.CreateNotebook(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func CreateProcessorTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateProcessorTaskReq var req types.CreateProcessorTaskReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewCreateProcessorTaskLogic(r.Context(), svcCtx) l := ai.NewCreateProcessorTaskLogic(r.Context(), svcCtx)
resp, err := l.CreateProcessorTask(&req) resp, err := l.CreateProcessorTask(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func CreateServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateServiceReq var req types.CreateServiceReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewCreateServiceLogic(r.Context(), svcCtx) l := ai.NewCreateServiceLogic(r.Context(), svcCtx)
resp, err := l.CreateService(&req) resp, err := l.CreateService(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func CreateTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.ImportTaskDataReq var req types.ImportTaskDataReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewCreateTaskLogic(r.Context(), svcCtx) l := ai.NewCreateTaskLogic(r.Context(), svcCtx)
resp, err := l.CreateTask(&req) resp, err := l.CreateTask(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func CreateTrainingJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateTrainingJobReq var req types.CreateTrainingJobReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewCreateTrainingJobLogic(r.Context(), svcCtx) l := ai.NewCreateTrainingJobLogic(r.Context(), svcCtx)
resp, err := l.CreateTrainingJob(&req) resp, err := l.CreateTrainingJob(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func CreateVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateVisualizationJobReq var req types.CreateVisualizationJobReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewCreateVisualizationJobLogic(r.Context(), svcCtx) l := ai.NewCreateVisualizationJobLogic(r.Context(), svcCtx)
resp, err := l.CreateVisualizationJob(&req) resp, err := l.CreateVisualizationJob(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func DeleteAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteAlgorithmReq var req types.DeleteAlgorithmReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewDeleteAlgorithmLogic(r.Context(), svcCtx) l := ai.NewDeleteAlgorithmLogic(r.Context(), svcCtx)
resp, err := l.DeleteAlgorithm(&req) resp, err := l.DeleteAlgorithm(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func DeleteDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteDataSetReq var req types.DeleteDataSetReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewDeleteDataSetLogic(r.Context(), svcCtx) l := ai.NewDeleteDataSetLogic(r.Context(), svcCtx)
resp, err := l.DeleteDataSet(&req) resp, err := l.DeleteDataSet(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func DeleteServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteServiceReq var req types.DeleteServiceReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewDeleteServiceLogic(r.Context(), svcCtx) l := ai.NewDeleteServiceLogic(r.Context(), svcCtx)
resp, err := l.DeleteService(&req) resp, err := l.DeleteService(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func DeleteTrainingJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteTrainingJobReq var req types.DeleteTrainingJobReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewDeleteTrainingJobLogic(r.Context(), svcCtx) l := ai.NewDeleteTrainingJobLogic(r.Context(), svcCtx)
resp, err := l.DeleteTrainingJob(&req) resp, err := l.DeleteTrainingJob(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func GetExportTasksOfDatasetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.GetExportTasksOfDatasetReq var req types.GetExportTasksOfDatasetReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewGetExportTasksOfDatasetLogic(r.Context(), svcCtx) l := ai.NewGetExportTasksOfDatasetLogic(r.Context(), svcCtx)
resp, err := l.GetExportTasksOfDataset(&req) resp, err := l.GetExportTasksOfDataset(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func GetExportTaskStatusOfDatasetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.GetExportTaskStatusOfDatasetReq var req types.GetExportTaskStatusOfDatasetReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewGetExportTaskStatusOfDatasetLogic(r.Context(), svcCtx) l := ai.NewGetExportTaskStatusOfDatasetLogic(r.Context(), svcCtx)
resp, err := l.GetExportTaskStatusOfDataset(&req) resp, err := l.GetExportTaskStatusOfDataset(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func GetListTrainingJobsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.ListTrainingJobsreq var req types.ListTrainingJobsreq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewGetListTrainingJobsLogic(r.Context(), svcCtx) l := ai.NewGetListTrainingJobsLogic(r.Context(), svcCtx)
resp, err := l.GetListTrainingJobs(&req) resp, err := l.GetListTrainingJobs(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func GetNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.GetNotebookStorageReq var req types.GetNotebookStorageReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewGetNotebookStorageLogic(r.Context(), svcCtx) l := ai.NewGetNotebookStorageLogic(r.Context(), svcCtx)
resp, err := l.GetNotebookStorage(&req) resp, err := l.GetNotebookStorage(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func GetVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.GetVisualizationJobReq var req types.GetVisualizationJobReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewGetVisualizationJobLogic(r.Context(), svcCtx) l := ai.NewGetVisualizationJobLogic(r.Context(), svcCtx)
resp, err := l.GetVisualizationJob(&req) resp, err := l.GetVisualizationJob(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func ListAlgorithmsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.ListAlgorithmsReq var req types.ListAlgorithmsReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewListAlgorithmsLogic(r.Context(), svcCtx) l := ai.NewListAlgorithmsLogic(r.Context(), svcCtx)
resp, err := l.ListAlgorithms(&req) resp, err := l.ListAlgorithms(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func ListClustersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.ListClustersReq var req types.ListClustersReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewListClustersLogic(r.Context(), svcCtx) l := ai.NewListClustersLogic(r.Context(), svcCtx)
resp, err := l.ListClusters(&req) resp, err := l.ListClusters(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func ListDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.DataSetReq var req types.DataSetReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewListDataSetLogic(r.Context(), svcCtx) l := ai.NewListDataSetLogic(r.Context(), svcCtx)
resp, err := l.ListDataSet(&req) resp, err := l.ListDataSet(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func ListImportHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.ListImportTasksReq var req types.ListImportTasksReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewListImportLogic(r.Context(), svcCtx) l := ai.NewListImportLogic(r.Context(), svcCtx)
resp, err := l.ListImport(&req) resp, err := l.ListImport(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func ListNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.ListNotebookReq var req types.ListNotebookReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewListNotebookLogic(r.Context(), svcCtx) l := ai.NewListNotebookLogic(r.Context(), svcCtx)
resp, err := l.ListNotebook(&req) resp, err := l.ListNotebook(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func ListServicesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.ListServicesReq var req types.ListServicesReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewListServicesLogic(r.Context(), svcCtx) l := ai.NewListServicesLogic(r.Context(), svcCtx)
resp, err := l.ListServices(&req) resp, err := l.ListServices(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func MountNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.MountNotebookStorageReq var req types.MountNotebookStorageReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewMountNotebookStorageLogic(r.Context(), svcCtx) l := ai.NewMountNotebookStorageLogic(r.Context(), svcCtx)
resp, err := l.MountNotebookStorage(&req) resp, err := l.MountNotebookStorage(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func ShowAlgorithmByUuidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.ShowAlgorithmByUuidReq var req types.ShowAlgorithmByUuidReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewShowAlgorithmByUuidLogic(r.Context(), svcCtx) l := ai.NewShowAlgorithmByUuidLogic(r.Context(), svcCtx)
resp, err := l.ShowAlgorithmByUuid(&req) resp, err := l.ShowAlgorithmByUuid(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func ShowServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.ShowServiceReq var req types.ShowServiceReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewShowServiceLogic(r.Context(), svcCtx) l := ai.NewShowServiceLogic(r.Context(), svcCtx)
resp, err := l.ShowService(&req) resp, err := l.ShowService(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func StartNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.StartNotebookReq var req types.StartNotebookReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewStartNotebookLogic(r.Context(), svcCtx) l := ai.NewStartNotebookLogic(r.Context(), svcCtx)
resp, err := l.StartNotebook(&req) resp, err := l.StartNotebook(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package ai package ai
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/ai"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func StopNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.StopNotebookReq var req types.StopNotebookReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := ai.NewStopNotebookLogic(r.Context(), svcCtx) l := ai.NewStopNotebookLogic(r.Context(), svcCtx)
resp, err := l.StopNotebook(&req) resp, err := l.StopNotebook(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package apps package apps
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/apps"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func AppDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.AppDetailReq var req types.AppDetailReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := apps.NewAppDetailLogic(r.Context(), svcCtx) l := apps.NewAppDetailLogic(r.Context(), svcCtx)
resp, err := l.AppDetail(&req) resp, err := l.AppDetail(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package apps package apps
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/apps"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func AppListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.AppListReq var req types.AppListReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := apps.NewAppListLogic(r.Context(), svcCtx) l := apps.NewAppListLogic(r.Context(), svcCtx)
resp, err := l.AppList(&req) resp, err := l.AppList(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package apps package apps
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/apps"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func AppPodsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.AppDetailReq var req types.AppDetailReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := apps.NewAppPodsLogic(r.Context(), svcCtx) l := apps.NewAppPodsLogic(r.Context(), svcCtx)
resp, err := l.AppPods(&req) resp, err := l.AppPods(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package apps package apps
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/apps"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func DeleteAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteAppReq var req types.DeleteAppReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := apps.NewDeleteAppByAppNameLogic(r.Context(), svcCtx) l := apps.NewDeleteAppByAppNameLogic(r.Context(), svcCtx)
resp, err := l.DeleteAppByAppName(&req) resp, err := l.DeleteAppByAppName(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package apps package apps
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/apps"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func GetAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.AppDetailReq var req types.AppDetailReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := apps.NewGetAppByAppNameLogic(r.Context(), svcCtx) l := apps.NewGetAppByAppNameLogic(r.Context(), svcCtx)
resp, err := l.GetAppByAppName(&req) resp, err := l.GetAppByAppName(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package apps package apps
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/apps"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func PauseAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteAppReq var req types.DeleteAppReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := apps.NewPauseAppByAppNameLogic(r.Context(), svcCtx) l := apps.NewPauseAppByAppNameLogic(r.Context(), svcCtx)
resp, err := l.PauseAppByAppName(&req) resp, err := l.PauseAppByAppName(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package apps package apps
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/apps"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func RestartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteAppReq var req types.DeleteAppReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := apps.NewRestartAppByAppNameLogic(r.Context(), svcCtx) l := apps.NewRestartAppByAppNameLogic(r.Context(), svcCtx)
resp, err := l.RestartAppByAppName(&req) resp, err := l.RestartAppByAppName(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package apps package apps
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/apps"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func StartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteAppReq var req types.DeleteAppReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := apps.NewStartAppByAppNameLogic(r.Context(), svcCtx) l := apps.NewStartAppByAppNameLogic(r.Context(), svcCtx)
resp, err := l.StartAppByAppName(&req) resp, err := l.StartAppByAppName(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package apps package apps
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/apps"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func UpdateAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteAppReq var req types.DeleteAppReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := apps.NewUpdateAppByAppNameLogic(r.Context(), svcCtx) l := apps.NewUpdateAppByAppNameLogic(r.Context(), svcCtx)
resp, err := l.UpdateAppByAppName(&req) resp, err := l.UpdateAppByAppName(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,21 +1,16 @@
package cloud package cloud
import ( 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/logic/cloud"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func CloudListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
l := cloud.NewCloudListLogic(r.Context(), svcCtx) l := cloud.NewCloudListLogic(r.Context(), svcCtx)
resp, err := l.CloudList() resp, err := l.CloudList()
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package cloud package cloud
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/cloud"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func ControllerMetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.ControllerMetricsReq var req types.ControllerMetricsReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := cloud.NewControllerMetricsLogic(r.Context(), svcCtx) l := cloud.NewControllerMetricsLogic(r.Context(), svcCtx)
resp, err := l.ControllerMetrics(&req) resp, err := l.ControllerMetrics(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package cloud package cloud
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/cloud"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func DeleteClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteClusterReq var req types.DeleteClusterReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := cloud.NewDeleteClusterLogic(r.Context(), svcCtx) l := cloud.NewDeleteClusterLogic(r.Context(), svcCtx)
resp, err := l.DeleteCluster(&req) resp, err := l.DeleteCluster(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package cloud package cloud
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/cloud"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func DeleteYamlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.ApplyReq var req types.ApplyReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := cloud.NewDeleteYamlLogic(r.Context(), svcCtx) l := cloud.NewDeleteYamlLogic(r.Context(), svcCtx)
resp, err := l.DeleteYaml(&req) resp, err := l.DeleteYaml(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package cloud package cloud
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/cloud"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func GetClusterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.GetClusterListReq var req types.GetClusterListReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := cloud.NewGetClusterListLogic(r.Context(), svcCtx) l := cloud.NewGetClusterListLogic(r.Context(), svcCtx)
resp, err := l.GetClusterList(&req) resp, err := l.GetClusterList(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,21 +1,16 @@
package cloud package cloud
import ( 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/logic/cloud"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func NoticeTenantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
l := cloud.NewNoticeTenantLogic(r.Context(), svcCtx) l := cloud.NewNoticeTenantLogic(r.Context(), svcCtx)
resp, err := l.NoticeTenant() resp, err := l.NoticeTenant()
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package cloud package cloud
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/cloud"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func RegisterClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.RegisterClusterReq var req types.RegisterClusterReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := cloud.NewRegisterClusterLogic(r.Context(), svcCtx) l := cloud.NewRegisterClusterLogic(r.Context(), svcCtx)
resp, err := l.RegisterCluster(&req) resp, err := l.RegisterCluster(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package cloud package cloud
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/cloud"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func UpdateTenantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.UpdateTenantReq var req types.UpdateTenantReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := cloud.NewUpdateTenantLogic(r.Context(), svcCtx) l := cloud.NewUpdateTenantLogic(r.Context(), svcCtx)
resp, err := l.UpdateTenant(&req) resp, err := l.UpdateTenant(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,11 +1,10 @@
package core package core
import ( import (
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func CenterResourcesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {

View File

@ -1,20 +1,19 @@
package core package core
import ( import (
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func CommitTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.CommitTaskReq var req types.CommitTaskReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }

View File

@ -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)
}
}
}

View File

@ -1,34 +1,19 @@
/*
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 package core
import ( import (
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func DeleteTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteTaskReq var req types.DeleteTaskReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }

View File

@ -1,35 +1,16 @@
/*
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 package core
import ( 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/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func GetComputilityStatisticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
l := core.NewGetComputilityStatisticsLogic(r.Context(), svcCtx) l := core.NewGetComputilityStatisticsLogic(r.Context(), svcCtx)
resp, err := l.GetComputilityStatistics() resp, err := l.GetComputilityStatistics()
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,35 +1,16 @@
/*
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 package core
import ( 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/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func GetComputingPowerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
l := core.NewGetComputingPowerLogic(r.Context(), svcCtx) l := core.NewGetComputingPowerLogic(r.Context(), svcCtx)
resp, err := l.GetComputingPower() resp, err := l.GetComputingPower()
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,35 +1,16 @@
/*
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 package core
import ( 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/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func GetGeneralInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
l := core.NewGetGeneralInfoLogic(r.Context(), svcCtx) l := core.NewGetGeneralInfoLogic(r.Context(), svcCtx)
resp, err := l.GetGeneralInfo() resp, err := l.GetGeneralInfo()
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,35 +1,16 @@
/*
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 package core
import ( 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/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func GetRegionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
l := core.NewGetRegionLogic(r.Context(), svcCtx) l := core.NewGetRegionLogic(r.Context(), svcCtx)
resp, err := l.GetRegion() resp, err := l.GetRegion()
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,26 +1,10 @@
/*
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 package core
import ( import (
"net/http"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "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/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
) )
func GetResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { func GetResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {

View File

@ -1,25 +1,10 @@
/*
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 package core
import ( import (
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func JobTotalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {

View File

@ -1,35 +1,16 @@
/*
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 package core
import ( 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/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func ListCenterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
l := core.NewListCenterLogic(r.Context(), svcCtx) l := core.NewListCenterLogic(r.Context(), svcCtx)
resp, err := l.ListCenter() resp, err := l.ListCenter()
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,42 +1,24 @@
/*
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 package core
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func ListClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.ListClusterReq var req types.ListClusterReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := core.NewListClusterLogic(r.Context(), svcCtx) l := core.NewListClusterLogic(r.Context(), svcCtx)
resp, err := l.ListCluster(&req) resp, err := l.ListCluster(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,35 +1,16 @@
/*
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 package core
import ( 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/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func ListRegionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
l := core.NewListRegionLogic(r.Context(), svcCtx) l := core.NewListRegionLogic(r.Context(), svcCtx)
resp, err := l.ListRegion() resp, err := l.ListRegion()
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,12 +1,16 @@
package core package core
import ( import (
"github.com/prometheus/client_golang/prometheus/promhttp" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
"net/http"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { 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()
result.HttpResult(r, w, nil, err)
}
} }

View File

@ -1,25 +1,10 @@
/*
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 package core
import ( import (
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func NodeAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {

View File

@ -1,25 +1,10 @@
/*
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 package core
import ( import (
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func ParticipantListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {

View File

@ -18,7 +18,7 @@ func PullTaskInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
} }
l := core.NewPullTaskInfoLogic(r.Context(), svcCtx) l := core.NewPullTaskInfoLogic(r.Context(), svcCtx)
resp, err := l.PullTaskInfo(&req) resp, err := l.PullTaskInfo((*clientCore.PullTaskInfoReq)(&req))
if err != nil { if err != nil {
httpx.ErrorCtx(r.Context(), w, err) httpx.ErrorCtx(r.Context(), w, err)
} else { } else {

View File

@ -1,28 +1,12 @@
/*
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 package core
import ( import (
"net/http"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func PutResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {

View File

@ -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 package core
import ( import (

View File

@ -1,20 +1,19 @@
package core package core
import ( import (
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func SyncClusterLoadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.SyncClusterLoadReq var req types.SyncClusterLoadReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }

View File

@ -1,34 +1,19 @@
/*
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 package core
import ( import (
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func TaskDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.TaskDetailReq var req types.TaskDetailReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }

View File

@ -1,42 +1,24 @@
/*
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 package core
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func TaskListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.TaskListReq var req types.TaskListReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := core.NewTaskListLogic(r.Context(), svcCtx) l := core.NewTaskListLogic(r.Context(), svcCtx)
resp, err := l.TaskList(&req) resp, err := l.TaskList(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package hpc package hpc
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/hpc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func CommitHpcTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.CommitHpcTaskReq var req types.CommitHpcTaskReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := hpc.NewCommitHpcTaskLogic(r.Context(), svcCtx) l := hpc.NewCommitHpcTaskLogic(r.Context(), svcCtx)
resp, err := l.CommitHpcTask(&req) resp, err := l.CommitHpcTask(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package hpc package hpc
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/hpc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func ListHistoryJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.ListHistoryJobReq var req types.ListHistoryJobReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := hpc.NewListHistoryJobLogic(r.Context(), svcCtx) l := hpc.NewListHistoryJobLogic(r.Context(), svcCtx)
resp, err := l.ListHistoryJob(&req) resp, err := l.ListHistoryJob(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package hpc package hpc
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/hpc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func ListJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.ListJobReq var req types.ListJobReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := hpc.NewListJobLogic(r.Context(), svcCtx) l := hpc.NewListJobLogic(r.Context(), svcCtx)
resp, err := l.ListJob(&req) resp, err := l.ListJob(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,21 +1,16 @@
package hpc package hpc
import ( 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/logic/hpc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func QueueAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
l := hpc.NewQueueAssetsLogic(r.Context(), svcCtx) l := hpc.NewQueueAssetsLogic(r.Context(), svcCtx)
resp, err := l.QueueAssets() resp, err := l.QueueAssets()
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,21 +1,16 @@
package image package image
import ( 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/logic/image"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func ChunkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
l := image.NewChunkLogic(r.Context(), svcCtx) l := image.NewChunkLogic(r.Context(), svcCtx)
err := l.Chunk() err := l.Chunk()
if err != nil { result.HttpResult(r, w, nil, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.Ok(w)
}
} }
} }

View File

@ -1,28 +1,24 @@
package image package image
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/image"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func DataSetCheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.CheckReq var req types.CheckReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := image.NewDataSetCheckLogic(r.Context(), svcCtx) l := image.NewDataSetCheckLogic(r.Context(), svcCtx)
resp, err := l.DataSetCheck(&req) resp, err := l.DataSetCheck(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,21 +1,16 @@
package image package image
import ( 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/logic/image"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func ImageListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
l := image.NewImageListLogic(r.Context(), svcCtx) l := image.NewImageListLogic(r.Context(), svcCtx)
resp, err := l.ImageList() resp, err := l.ImageList()
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,21 +1,16 @@
package image package image
import ( 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/logic/image"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func UploadDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
l := image.NewUploadDataSetLogic(r.Context(), svcCtx) l := image.NewUploadDataSetLogic(r.Context(), svcCtx)
err := l.UploadDataSet() err := l.UploadDataSet()
if err != nil { result.HttpResult(r, w, nil, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.Ok(w)
}
} }
} }

View File

@ -1,21 +1,16 @@
package image package image
import ( 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/logic/image"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func UploadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
l := image.NewUploadLogic(r.Context(), svcCtx) l := image.NewUploadLogic(r.Context(), svcCtx)
err := l.Upload() err := l.Upload()
if err != nil { result.HttpResult(r, w, nil, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.Ok(w)
}
} }
} }

View File

@ -44,6 +44,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/core/commitVmTask", Path: "/core/commitVmTask",
Handler: core.CommitVmTaskHandler(serverCtx), Handler: core.CommitVmTaskHandler(serverCtx),
}, },
{
Method: http.MethodPost,
Path: "/core/commitVmTaskTemp",
Handler: core.CommitVmTaskTempHandler(serverCtx),
},
{ {
Method: http.MethodDelete, Method: http.MethodDelete,
Path: "/core/deleteTask/:id", Path: "/core/deleteTask/:id",
@ -139,6 +144,16 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/core/cluster/load", Path: "/core/cluster/load",
Handler: core.ClustersLoadHandler(serverCtx), Handler: core.ClustersLoadHandler(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"), rest.WithPrefix("/pcm/v1"),
) )

View File

@ -1,21 +1,16 @@
package schedule package schedule
import ( 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/logic/schedule"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func ScheduleGetAiResourceTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
l := schedule.NewScheduleGetAiResourceTypesLogic(r.Context(), svcCtx) l := schedule.NewScheduleGetAiResourceTypesLogic(r.Context(), svcCtx)
resp, err := l.ScheduleGetAiResourceTypes() resp, err := l.ScheduleGetAiResourceTypes()
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,21 +1,16 @@
package schedule package schedule
import ( 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/logic/schedule"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func ScheduleGetAiTaskTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
l := schedule.NewScheduleGetAiTaskTypesLogic(r.Context(), svcCtx) l := schedule.NewScheduleGetAiTaskTypesLogic(r.Context(), svcCtx)
resp, err := l.ScheduleGetAiTaskTypes() resp, err := l.ScheduleGetAiTaskTypes()
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,21 +1,16 @@
package schedule package schedule
import ( 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/logic/schedule"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func ScheduleGetDatasetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
l := schedule.NewScheduleGetDatasetsLogic(r.Context(), svcCtx) l := schedule.NewScheduleGetDatasetsLogic(r.Context(), svcCtx)
resp, err := l.ScheduleGetDatasets() resp, err := l.ScheduleGetDatasets()
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,21 +1,16 @@
package schedule package schedule
import ( 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/logic/schedule"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "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 { func ScheduleGetStrategyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
l := schedule.NewScheduleGetStrategyLogic(r.Context(), svcCtx) l := schedule.NewScheduleGetStrategyLogic(r.Context(), svcCtx)
resp, err := l.ScheduleGetStrategy() resp, err := l.ScheduleGetStrategy()
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package schedule package schedule
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/schedule"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func ScheduleSubmitHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.ScheduleReq var req types.ScheduleReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := schedule.NewScheduleSubmitLogic(r.Context(), svcCtx) l := schedule.NewScheduleSubmitLogic(r.Context(), svcCtx)
resp, err := l.ScheduleSubmit(&req) resp, err := l.ScheduleSubmit(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package storage package storage
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/storage"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func DailyPowerScreenHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.DailyPowerScreenReq var req types.DailyPowerScreenReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := storage.NewDailyPowerScreenLogic(r.Context(), svcCtx) l := storage.NewDailyPowerScreenLogic(r.Context(), svcCtx)
resp, err := l.DailyPowerScreen(&req) resp, err := l.DailyPowerScreen(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package storage package storage
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/storage"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func PerCenterComputerPowersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.PerCenterComputerPowersReq var req types.PerCenterComputerPowersReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := storage.NewPerCenterComputerPowersLogic(r.Context(), svcCtx) l := storage.NewPerCenterComputerPowersLogic(r.Context(), svcCtx)
resp, err := l.PerCenterComputerPowers(&req) resp, err := l.PerCenterComputerPowers(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -1,28 +1,24 @@
package storage package storage
import ( import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx" "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/logic/storage"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" "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 { func ScreenStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
var req types.StorageScreenReq var req types.StorageScreenReq
if err := httpx.Parse(r, &req); err != nil { if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err) result.ParamErrorResult(r, w, err)
return return
} }
l := storage.NewScreenStorageLogic(r.Context(), svcCtx) l := storage.NewScreenStorageLogic(r.Context(), svcCtx)
resp, err := l.ScreenStorage(&req) resp, err := l.ScreenStorage(&req)
if err != nil { result.HttpResult(r, w, resp, err)
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
} }
} }

View File

@ -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{} resp = &types.PageResult{}
var list []types.AdapterInfo var list []types.AdapterInfo
db := l.svcCtx.DbEngin.Model(&types.AdapterInfo{}).Table("t_adapter") db := l.svcCtx.DbEngin.Model(&types.AdapterInfo{}).Table("t_adapter")

View File

@ -28,7 +28,8 @@ func (l *GetClusterSumLogic) GetClusterSum(req *types.ClusterSumReq) (resp *type
resp = &types.ClusterSumReqResp{} resp = &types.ClusterSumReqResp{}
var AdapterSum int // var AdapterSum int //
var ClusterSum int // var podSum int //
var vmSum int //
var TaskSum int // var TaskSum int //
// //
sqlStr := "SELECT COUNT(*) FROM `t_adapter` t where t.type = 0" 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) logx.Error(err)
return nil, tx.Error return nil, tx.Error
} }
// //vm
sqlStrCluster := "SELECT COUNT(*) FROM `t_cluster`t where t.label ='openstack' || t.label='kubernetes'\n" 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"
txCluster := l.svcCtx.DbEngin.Raw(sqlStrCluster).Scan(&ClusterSum) txClusterVm := l.svcCtx.DbEngin.Raw(sqlStrVm).Scan(&vmSum)
if txCluster.Error != nil { if txClusterVm.Error != nil {
logx.Error(err) 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`" sqlStrTask := "SELECT COUNT(*) FROM `task`"
@ -52,7 +60,8 @@ func (l *GetClusterSumLogic) GetClusterSum(req *types.ClusterSumReq) (resp *type
return nil, txTask.Error return nil, txTask.Error
} }
resp.TaskSum = TaskSum resp.TaskSum = TaskSum
resp.ClusterSum = ClusterSum resp.VmSum = vmSum
resp.PodSum = podSum
resp.AdapterSum = AdapterSum resp.AdapterSum = AdapterSum
return resp, nil return resp, nil
} }

View File

@ -8,6 +8,7 @@ import (
"gitlink.org.cn/JointCloud/pcm-coordinator/api/pkg/response" "gitlink.org.cn/JointCloud/pcm-coordinator/api/pkg/response"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants" "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models" "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models"
tool "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils"
"time" "time"
"github.com/zeromicro/go-zero/core/logx" "github.com/zeromicro/go-zero/core/logx"
@ -41,14 +42,15 @@ func (l *CommitVmTaskLogic) CommitVmTask(req *types.CommitVmTaskReq) (resp *type
if tx.Error != nil { if tx.Error != nil {
return nil, tx.Error return nil, tx.Error
} }
/* hpc := models.Hpc{} vm := models.Vm{}
tool.Convert(req, &hpc)*/ tool.Convert(req, &vm)
mqInfo := response.TaskInfo{ mqInfo := response.TaskInfo{
TaskId: taskModel.Id, TaskId: taskModel.Id,
TaskType: "vm", TaskType: "vm",
MatchLabels: req.MatchLabels, MatchLabels: req.MatchLabels,
NsID: req.NsID, NsID: req.NsID,
} }
//req.TaskId = taskModel.Id
mqs.InsQueue.Beta.Add(&mqInfo) mqs.InsQueue.Beta.Add(&mqInfo)
return return
} }

View File

@ -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
}

Some files were not shown because too many files have changed in this diff Show More