# 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)
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"
)
type PullTaskInfoReq struct {
AdapterId int64 `form:"adapterId"`
}
type PullTaskInfoResp struct {
HpcInfoList []*HpcInfo `json:"HpcInfoList,omitempty"`
CloudInfoList []*CloudInfo `json:"CloudInfoList,omitempty"`
AiInfoList []*AiInfo `json:"AiInfoList,omitempty"`
VmInfoList []*VmInfo `json:"VmInfoList,omitempty"`
}
type PushTaskInfoReq struct {
AdapterId int64 `json:"adapterId"`
HpcInfoList []*HpcInfo `json:"HpcInfoList,omitempty,optional"`
CloudInfoList []*CloudInfo `json:"CloudInfoList,omitempty,optional"`
AiInfoList []*AiInfo `json:"AiInfoList,omitempty,optional"`
VmInfoList []*VmInfo `json:"VmInfoList,omitempty,optional"`
}
type PushTaskInfoResp struct {
Code int64
Msg string
}
type PushResourceInfoReq struct {
AdapterId int64 `json:"adapterId"`
}
type HpcInfo struct {
Id int64 `json:"id"` // id
TaskId int64 `json:"task_id"` // 任务id

View File

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

View File

@ -23,27 +23,30 @@ type (
Description string `json:"description,optional"`
tenantId int64 `json:"tenantId,optional"`
TaskId int64 `json:"taskId,optional"`
participantId int64 `json:"participantId,optional"`
matchLabels map[string]string `json:"matchLabels,optional"`
cardCount int64 `json:"cardCount,optional"`
workDir string `json:"workDir,optional"` //paratera:workingDir
wallTime string `json:"wallTime,optional"`
cmdScript string `json:"cmdScript,optional"` // paratera:bootScript
appType string `json:"appType,optional"`
appName string `json:"appName,optional"` // paratera:jobGroupName ac:appname
queue string `json:"queue,optional"`
nNode string `json:"nNode,optional"`
submitType string `json:"submitType,optional"`
stdOutFile string `json:"stdOutFile,optional"`
stdErrFile string `json:"stdErrFile,optional"`
stdInput string `json:"stdInput,optional"`
environment map[string]string `json:"environment,optional"`
AdapterId int64 `json:"adapterId,optional"`
MatchLabels map[string]string `json:"matchLabels,optional"`
CardCount int64 `json:"cardCount,optional"`
WorkDir string `json:"workDir,optional"` //paratera:workingDir
WallTime string `json:"wallTime,optional"`
CmdScript string `json:"cmdScript,optional"` // paratera:bootScript
AppType string `json:"appType,optional"`
AppName string `json:"appName,optional"` // paratera:jobGroupName ac:appname
Queue string `json:"queue,optional"`
NNode string `json:"nNode,optional"`
SubmitType string `json:"submitType,optional"`
StdOutFile string `json:"stdOutFile,optional"`
StdErrFile string `json:"stdErrFile,optional"`
StdInput string `json:"stdInput,optional"`
Environment map[string]string `json:"environment,optional"`
ClusterType string `json:"clusterType,optional"`
}
)
type (
commitHpcTaskResp {
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"
"storelink/pcm-storelink.api"
"schedule/pcm-schedule.api"
"participant/pcm-participant.api"
)
info(
@ -41,6 +42,10 @@ service pcm {
@handler commitVmTaskHandler
post /core/commitVmTask (commitVmTaskReq) returns (commitVmTaskResp)
@doc "提交虚拟机任务临时"
@handler commitVmTaskTempHandler
post /core/commitVmTaskTemp (commitVmTaskReq) returns (commitVmTaskResp)
@doc "删除任务"
@handler deleteTaskHandler
delete /core/deleteTask/:id (deleteTaskReq)
@ -109,6 +114,14 @@ service pcm {
@handler metricsHandler
get /core/metrics
@doc "provided to participant to pull task info from core"
@handler pullTaskInfoHandler
get /core/pullTaskInfo (PullTaskInfoReq) returns (PullTaskInfoResp)
@doc "provided to participant to push task info to core"
@handler pushTaskInfoHandler
post /core/pushTaskInfo (PushTaskInfoReq) returns (PushTaskInfoResp)
@doc "alert rules"
@handler alertRulesHandler
get /core/alert/rules
@ -855,7 +868,7 @@ service pcm {
get /adapter/cluster/get (FId) returns (ClusterResp)
@handler GetAdapterRelationHandler
get /adapter/relation (AdapterQueryReq) returns (PageResult)
get /adapter/relation (AdapterRelationQueryReq) returns (PageResult)
@handler GetClusterSumHandler
get /adapter/clusterSum (clusterSumReq) returns (clusterSumReqResp)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,21 +1,16 @@
package cloud
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
func CloudListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := cloud.NewCloudListLogic(r.Context(), svcCtx)
resp, err := l.CloudList()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
result.HttpResult(r, w, resp, err)
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -1,21 +1,16 @@
package cloud
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
func NoticeTenantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := cloud.NewNoticeTenantLogic(r.Context(), svcCtx)
resp, err := l.NoticeTenant()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
result.HttpResult(r, w, resp, err)
}
}

View File

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

View File

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

View File

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

View File

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

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

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
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
func GetComputilityStatisticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := core.NewGetComputilityStatisticsLogic(r.Context(), svcCtx)
resp, err := l.GetComputilityStatistics()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
result.HttpResult(r, w, resp, err)
}
}

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
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
func GetComputingPowerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := core.NewGetComputingPowerLogic(r.Context(), svcCtx)
resp, err := l.GetComputingPower()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
result.HttpResult(r, w, resp, err)
}
}

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
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
func GetGeneralInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := core.NewGetGeneralInfoLogic(r.Context(), svcCtx)
resp, err := l.GetGeneralInfo()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
result.HttpResult(r, w, resp, err)
}
}

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
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
func GetRegionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := core.NewGetRegionLogic(r.Context(), svcCtx)
resp, err := l.GetRegion()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
result.HttpResult(r, w, resp, err)
}
}

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
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/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
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
import (
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
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
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
func ListCenterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := core.NewListCenterLogic(r.Context(), svcCtx)
resp, err := l.ListCenter()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
result.HttpResult(r, w, resp, err)
}
}

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

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
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
func ListRegionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := core.NewListRegionLogic(r.Context(), svcCtx)
resp, err := l.ListRegion()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
result.HttpResult(r, w, resp, err)
}
}

View File

@ -1,12 +1,16 @@
package core
import (
"github.com/prometheus/client_golang/prometheus/promhttp"
"net/http"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
func MetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return 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
import (
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
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
import (
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
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)
resp, err := l.PullTaskInfo(&req)
resp, err := l.PullTaskInfo((*clientCore.PullTaskInfoReq)(&req))
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} 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
import (
"net/http"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"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 {

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
import (

View File

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

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

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

View File

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

View File

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

View File

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

View File

@ -1,21 +1,16 @@
package hpc
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
func QueueAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := hpc.NewQueueAssetsLogic(r.Context(), svcCtx)
resp, err := l.QueueAssets()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
result.HttpResult(r, w, resp, err)
}
}

View File

@ -1,21 +1,16 @@
package image
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
func ChunkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := image.NewChunkLogic(r.Context(), svcCtx)
err := l.Chunk()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.Ok(w)
}
result.HttpResult(r, w, nil, err)
}
}

View File

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

View File

@ -1,21 +1,16 @@
package image
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
func ImageListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := image.NewImageListLogic(r.Context(), svcCtx)
resp, err := l.ImageList()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
result.HttpResult(r, w, resp, err)
}
}

View File

@ -1,21 +1,16 @@
package image
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
func UploadDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := image.NewUploadDataSetLogic(r.Context(), svcCtx)
err := l.UploadDataSet()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.Ok(w)
}
result.HttpResult(r, w, nil, err)
}
}

View File

@ -1,21 +1,16 @@
package image
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
func UploadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := image.NewUploadLogic(r.Context(), svcCtx)
err := l.Upload()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.Ok(w)
}
result.HttpResult(r, w, nil, err)
}
}

View File

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

View File

@ -1,21 +1,16 @@
package schedule
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
func ScheduleGetAiResourceTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := schedule.NewScheduleGetAiResourceTypesLogic(r.Context(), svcCtx)
resp, err := l.ScheduleGetAiResourceTypes()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
result.HttpResult(r, w, resp, err)
}
}

View File

@ -1,21 +1,16 @@
package schedule
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
func ScheduleGetAiTaskTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := schedule.NewScheduleGetAiTaskTypesLogic(r.Context(), svcCtx)
resp, err := l.ScheduleGetAiTaskTypes()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
result.HttpResult(r, w, resp, err)
}
}

View File

@ -1,21 +1,16 @@
package schedule
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
func ScheduleGetDatasetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := schedule.NewScheduleGetDatasetsLogic(r.Context(), svcCtx)
resp, err := l.ScheduleGetDatasets()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
result.HttpResult(r, w, resp, err)
}
}

View File

@ -1,21 +1,16 @@
package schedule
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule"
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
"net/http"
)
func ScheduleGetStrategyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := schedule.NewScheduleGetStrategyLogic(r.Context(), svcCtx)
resp, err := l.ScheduleGetStrategy()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
result.HttpResult(r, w, resp, err)
}
}

View File

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

View File

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

View File

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

View File

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

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{}
var list []types.AdapterInfo
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{}
var AdapterSum int //
var ClusterSum int //
var podSum int //
var vmSum int //
var TaskSum int //
//
sqlStr := "SELECT COUNT(*) FROM `t_adapter` t where t.type = 0"
@ -37,12 +38,19 @@ func (l *GetClusterSumLogic) GetClusterSum(req *types.ClusterSumReq) (resp *type
logx.Error(err)
return nil, tx.Error
}
//
sqlStrCluster := "SELECT COUNT(*) FROM `t_cluster`t where t.label ='openstack' || t.label='kubernetes'\n"
txCluster := l.svcCtx.DbEngin.Raw(sqlStrCluster).Scan(&ClusterSum)
if txCluster.Error != nil {
//vm
sqlStrVm := "SELECT COUNT(*) FROM `t_adapter` t left join t_cluster tc on t.id=tc.adapter_id where t.type='3' and tc.deleted_at is null"
txClusterVm := l.svcCtx.DbEngin.Raw(sqlStrVm).Scan(&vmSum)
if txClusterVm.Error != nil {
logx.Error(err)
return nil, txCluster.Error
return nil, txClusterVm.Error
}
//pod
sqlStrPod := "SELECT COUNT(*) FROM `t_adapter` t left join t_cluster tc on t.id=tc.adapter_id where t.type='0' and tc.deleted_at is null"
txClusterPod := l.svcCtx.DbEngin.Raw(sqlStrPod).Scan(&podSum)
if txClusterPod.Error != nil {
logx.Error(err)
return nil, txClusterPod.Error
}
//
sqlStrTask := "SELECT COUNT(*) FROM `task`"
@ -52,7 +60,8 @@ func (l *GetClusterSumLogic) GetClusterSum(req *types.ClusterSumReq) (resp *type
return nil, txTask.Error
}
resp.TaskSum = TaskSum
resp.ClusterSum = ClusterSum
resp.VmSum = vmSum
resp.PodSum = podSum
resp.AdapterSum = AdapterSum
return resp, nil
}

View File

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

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