diff --git a/api/client/task.go b/api/client/task.go index 086249f7..3367ab95 100644 --- a/api/client/task.go +++ b/api/client/task.go @@ -11,31 +11,3 @@ type Task interface { PushTaskInfo(pushTaskInfoReq PushTaskInfoReq) (*PushTaskInfoResp, error) PushResourceInfo(pushResourceInfoReq PushResourceInfoReq) error } - -type PullTaskInfoReq struct { - AdapterId int64 `json:"adapterId"` -} - -type PullTaskInfoResp struct { - HpcInfoList []*HpcInfo `json:"HpcInfoList,omitempty"` - CloudInfoList []*CloudInfo `json:"CloudInfoList,omitempty"` - AiInfoList []*AiInfo `json:"AiInfoList,omitempty"` - VmInfoList []*VmInfo `json:"VmInfoList,omitempty"` -} - -type PushTaskInfoReq struct { - AdapterId int64 `json:"adapterId"` - HpcInfoList []*HpcInfo - CloudInfoList []*CloudInfo - AiInfoList []*AiInfo - VmInfoList []*VmInfo -} - -type PushTaskInfoResp struct { - Code int64 - Msg string -} - -type PushResourceInfoReq struct { - AdapterId int64 `json:"adapterId"` -} diff --git a/api/client/types.go b/api/client/types.go index 155ad628..758f6bcb 100644 --- a/api/client/types.go +++ b/api/client/types.go @@ -5,6 +5,34 @@ import ( "time" ) +type PullTaskInfoReq struct { + AdapterId int64 `form:"adapterId"` +} + +type PullTaskInfoResp struct { + HpcInfoList []*HpcInfo `json:"HpcInfoList,omitempty"` + CloudInfoList []*CloudInfo `json:"CloudInfoList,omitempty"` + AiInfoList []*AiInfo `json:"AiInfoList,omitempty"` + VmInfoList []*VmInfo `json:"VmInfoList,omitempty"` +} + +type PushTaskInfoReq struct { + AdapterId int64 `json:"adapterId"` + HpcInfoList []*HpcInfo `json:"HpcInfoList,omitempty,optional"` + CloudInfoList []*CloudInfo `json:"CloudInfoList,omitempty,optional"` + AiInfoList []*AiInfo `json:"AiInfoList,omitempty,optional"` + VmInfoList []*VmInfo `json:"VmInfoList,omitempty,optional"` +} + +type PushTaskInfoResp struct { + Code int64 + Msg string +} + +type PushResourceInfoReq struct { + AdapterId int64 `json:"adapterId"` +} + type HpcInfo struct { Id int64 `json:"id"` // id TaskId int64 `json:"task_id"` // 任务id diff --git a/api/desc/core/pcm-core.api b/api/desc/core/pcm-core.api index d8160a75..f36d67dd 100644 --- a/api/desc/core/pcm-core.api +++ b/api/desc/core/pcm-core.api @@ -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"` } diff --git a/api/desc/hpc/pcm-hpc.api b/api/desc/hpc/pcm-hpc.api index 38f0ed08..2a971c4d 100644 --- a/api/desc/hpc/pcm-hpc.api +++ b/api/desc/hpc/pcm-hpc.api @@ -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"` } ) diff --git a/api/desc/participant/pcm-participant.api b/api/desc/participant/pcm-participant.api new file mode 100644 index 00000000..f77be78e --- /dev/null +++ b/api/desc/participant/pcm-participant.api @@ -0,0 +1,125 @@ +syntax = "v1" + +info( + title: "type title here" + desc: "type desc here" + author: "type author here" + email: "type email here" + version: "type version here" +) + +type PullTaskInfoReq { + AdapterId int64 `form:"adapterId"` +} + +type PullTaskInfoResp struct { + HpcInfoList []*HpcInfo `json:"HpcInfoList,omitempty"` + CloudInfoList []*CloudInfo `json:"CloudInfoList,omitempty"` + AiInfoList []*AiInfo `json:"AiInfoList,omitempty"` + VmInfoList []*VmInfo `json:"VmInfoList,omitempty"` +} + +type HpcInfo struct { + Id int64 `json:"id"` // id + TaskId int64 `json:"task_id"` // 任务id + JobId string `json:"job_id"` // 作业id(在第三方系统中的作业id) + ClusterId int64 `json:"cluster_id"` // 执行任务的集群id + ClusterType string `json:"cluster_type"` // 执行任务的集群类型 + Name string `json:"name"` // 名称 + Status string `json:"status"` // 状态 + CmdScript string `json:"cmd_script"` + StartTime string `json:"start_time"` // 开始时间 + RunningTime int64 `json:"running_time"` // 运行时间 + DerivedEs string `json:"derived_es"` + Cluster string `json:"cluster"` + BlockId int64 `json:"block_id"` + AllocNodes int64 `json:"alloc_nodes"` + AllocCpu int64 `json:"alloc_cpu"` + CardCount int64 `json:"card_count"` // 卡数 + Version string `json:"version"` + Account string `json:"account"` + WorkDir string `json:"work_dir"` // 工作路径 + AssocId int64 `json:"assoc_id"` + ExitCode int64 `json:"exit_code"` + WallTime string `json:"wall_time"` // 最大运行时间 + Result string `json:"result"` // 运行结果 + DeletedAt string `json:"deleted_at"` // 删除时间 + YamlString string `json:"yaml_string"` + AppType string `json:"app_type"` // 应用类型 + AppName string `json:"app_name"` // 应用名称 + Queue string `json:"queue"` // 队列名称 + SubmitType string `json:"submit_type"` // cmd(命令行模式) + NNode string `json:"n_node"` // 节点个数(当指定该参数时,GAP_NODE_STRING必须为"") + StdOutFile string `json:"std_out_file"` // 工作路径/std.err.%j + StdErrFile string `json:"std_err_file"` // 工作路径/std.err.%j + StdInput string `json:"std_input"` + Environment string `json:"environment"` + DeletedFlag int64 `json:"deleted_flag"` // 是否删除(0-否,1-是) + CreatedBy int64 `json:"created_by"` // 创建人 + CreatedTime string `json:"created_time"` // 创建时间 + UpdatedBy int64 `json:"updated_by"` // 更新人 + UpdatedTime string `json:"updated_time"` // 更新时间 +} + +type CloudInfo struct { + Participant int64 `json:"participant,omitempty"` + Id int64 `json:"id,omitempty"` + TaskId int64 `json:"taskId,omitempty"` + ApiVersion string `json:"apiVersion,omitempty"` + Kind string `json:"kind,omitempty"` + Namespace string `json:"namespace,omitempty"` + Name string `json:"name,omitempty"` + Status string `json:"status,omitempty"` + StartTime string `json:"startTime,omitempty"` + RunningTime int64 `json:"runningTime,omitempty"` + Result string `json:"result,omitempty"` + YamlString string `json:"yamlString,omitempty"` +} + +type AiInfo struct { + ParticipantId int64 `json:"participantId,omitempty"` + TaskId int64 `json:"taskId,omitempty"` + ProjectId string `json:"project_id,omitempty"` + Name string `json:"name,omitempty"` + Status string `json:"status,omitempty"` + StartTime string `json:"startTime,omitempty"` + RunningTime int64 `json:"runningTime,omitempty"` + Result string `json:"result,omitempty"` + JobId string `json:"jobId,omitempty"` + CreateTime string `json:"createTime,omitempty"` + ImageUrl string `json:"imageUrl,omitempty"` + Command string `json:"command,omitempty"` + FlavorId string `json:"flavorId,omitempty"` + SubscriptionId string `json:"subscriptionId,omitempty"` + ItemVersionId string `json:"itemVersionId,omitempty"` +} + +type VmInfo struct { + ParticipantId int64 `json:"participantId,omitempty"` + TaskId int64 `json:"taskId,omitempty"` + Name string `json:"name,omitempty"` + FlavorRef string `json:"flavor_ref,omitempty"` + ImageRef string `json:"image_ref,omitempty"` + NetworkUuid string `json:"network_uuid,omitempty"` + BlockUuid string `json:"block_uuid,omitempty"` + SourceType string `json:"source_type,omitempty"` + DeleteOnTermination bool `json:"delete_on_termination,omitempty"` + State string `json:"state,omitempty"` +} + +type PushTaskInfoReq struct { + AdapterId int64 `json:"adapterId"` + HpcInfoList []*HpcInfo `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"` +} \ No newline at end of file diff --git a/api/desc/pcm.api b/api/desc/pcm.api index f527f111..19776b9e 100644 --- a/api/desc/pcm.api +++ b/api/desc/pcm.api @@ -9,6 +9,7 @@ import ( "cloud/pcm-cloud.api" "storelink/pcm-storelink.api" "schedule/pcm-schedule.api" + "participant/pcm-participant.api" ) info( @@ -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) diff --git a/api/desc/vm/pcm-vm.api b/api/desc/vm/pcm-vm.api index e51ebf21..361b86d4 100644 --- a/api/desc/vm/pcm-vm.api +++ b/api/desc/vm/pcm-vm.api @@ -36,7 +36,7 @@ type ( absolute Absolute `json:"absolute,optional"` } GetComputeLimitsReq { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } GetComputeLimitsResp { @@ -66,7 +66,7 @@ type ( absolute VolumeAbsolute `json:"absolute,optional"` } GetVolumeLimitsReq { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } GetVolumeLimitsResp { @@ -81,7 +81,7 @@ type ( ListServersReq { Limit int32 `form:"limit,optional"` OffSet int32 `form:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } ListServersResp { TotalNumber uint32 `json:"totalNumber" copier:"TotalNumber"` @@ -111,7 +111,7 @@ type ( type ( ListServersDetailedReq { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } ListServersDetailedResp { ServersDetailed []ServersDetailed `json:"servers" copier:"ServersDetailed"` @@ -137,7 +137,7 @@ type ( type( GetServersDetailedByIdReq{ ServerId string `form:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } GetServersDetailedByIdResp{ @@ -222,7 +222,7 @@ type( UpdateServerReq{ ServerId string `form:"server_id" copier:"ServerId"` ServerUpdate ServerUpdate `json:"server_update" copier:"ServerUpdate"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } ServerUpdate{ Server Server `json:"server" copier:"Server"` @@ -239,7 +239,7 @@ type ( ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"action,optional" copier:"Action"` start_action string `json:"start_action" copier:"start_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } StartServerResp { Msg string `json:"msg,omitempty"` @@ -253,19 +253,20 @@ type( ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"action,optional" copier:"Action"` stop_action string `json:"stop_action" copier:"stop_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } StopServerResp { Msg string `json:"msg,omitempty"` ErrorMsg string `json:"errorMsg,omitempty"` - Code int32 `json:"code,omitempty"` } + Code int32 `json:"code,omitempty"` + } ) type( RebootServerReq{ ServerId string `json:"server_id" copier:"ServerId"` Reboot Reboot `json:"reboot" copier:"Reboot"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } RebootServerResp { Msg string `json:"msg,omitempty"` @@ -281,7 +282,7 @@ type( ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` pause_action string `json:"pause_action" copier:"pause_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } PauseServerResp { Msg string `json:"msg,omitempty"` @@ -295,7 +296,7 @@ type( ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` unpause_action string `json:"unpause_action" copier:"unpause_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } UnpauseServerResp { Msg string `json:"msg,omitempty"` @@ -307,7 +308,7 @@ type( type ( DeleteServerReq { ServerId string `form:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } DeleteServerResp { @@ -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"` diff --git a/api/etc/pcm.yaml b/api/etc/pcm.yaml index 9abf8f72..b56379a7 100644 --- a/api/etc/pcm.yaml +++ b/api/etc/pcm.yaml @@ -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 diff --git a/api/internal/handler/adapters/getadapterrelationhandler.go b/api/internal/handler/adapters/getadapterrelationhandler.go index 5695767b..1f265676 100644 --- a/api/internal/handler/adapters/getadapterrelationhandler.go +++ b/api/internal/handler/adapters/getadapterrelationhandler.go @@ -11,7 +11,7 @@ import ( func GetAdapterRelationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - var req types.AdapterQueryReq + var req types.AdapterRelationQueryReq if err := httpx.Parse(r, &req); err != nil { result.ParamErrorResult(r, w, err) return diff --git a/api/internal/handler/ai/createalgorithmhandler.go b/api/internal/handler/ai/createalgorithmhandler.go index e0ebcb34..f6c4e3bb 100644 --- a/api/internal/handler/ai/createalgorithmhandler.go +++ b/api/internal/handler/ai/createalgorithmhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func CreateAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CreateAlgorithmReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewCreateAlgorithmLogic(r.Context(), svcCtx) resp, err := l.CreateAlgorithm(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/createdatasethandler.go b/api/internal/handler/ai/createdatasethandler.go index 57bb2728..424005b4 100644 --- a/api/internal/handler/ai/createdatasethandler.go +++ b/api/internal/handler/ai/createdatasethandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func CreateDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CreateDataSetReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewCreateDataSetLogic(r.Context(), svcCtx) resp, err := l.CreateDataSet(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/createexporttaskhandler.go b/api/internal/handler/ai/createexporttaskhandler.go index bcc64381..7dbf1228 100644 --- a/api/internal/handler/ai/createexporttaskhandler.go +++ b/api/internal/handler/ai/createexporttaskhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func CreateExportTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CreateExportTaskReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewCreateExportTaskLogic(r.Context(), svcCtx) resp, err := l.CreateExportTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/createnotebookhandler.go b/api/internal/handler/ai/createnotebookhandler.go index 4bf997fc..14dd0460 100644 --- a/api/internal/handler/ai/createnotebookhandler.go +++ b/api/internal/handler/ai/createnotebookhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func CreateNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CreateNotebookReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewCreateNotebookLogic(r.Context(), svcCtx) resp, err := l.CreateNotebook(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/createprocessortaskhandler.go b/api/internal/handler/ai/createprocessortaskhandler.go index b2dc6f55..00167d1e 100644 --- a/api/internal/handler/ai/createprocessortaskhandler.go +++ b/api/internal/handler/ai/createprocessortaskhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func CreateProcessorTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CreateProcessorTaskReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewCreateProcessorTaskLogic(r.Context(), svcCtx) resp, err := l.CreateProcessorTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/createservicehandler.go b/api/internal/handler/ai/createservicehandler.go index dd8ef32a..4d9159ac 100644 --- a/api/internal/handler/ai/createservicehandler.go +++ b/api/internal/handler/ai/createservicehandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func CreateServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CreateServiceReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewCreateServiceLogic(r.Context(), svcCtx) resp, err := l.CreateService(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/createtaskhandler.go b/api/internal/handler/ai/createtaskhandler.go index c1632e63..85c62920 100644 --- a/api/internal/handler/ai/createtaskhandler.go +++ b/api/internal/handler/ai/createtaskhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func CreateTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ImportTaskDataReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewCreateTaskLogic(r.Context(), svcCtx) resp, err := l.CreateTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/createtrainingjobhandler.go b/api/internal/handler/ai/createtrainingjobhandler.go index f159bf06..f0c3eb9b 100644 --- a/api/internal/handler/ai/createtrainingjobhandler.go +++ b/api/internal/handler/ai/createtrainingjobhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func CreateTrainingJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CreateTrainingJobReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewCreateTrainingJobLogic(r.Context(), svcCtx) resp, err := l.CreateTrainingJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/createvisualizationjobhandler.go b/api/internal/handler/ai/createvisualizationjobhandler.go index b66ffa7c..971404ea 100644 --- a/api/internal/handler/ai/createvisualizationjobhandler.go +++ b/api/internal/handler/ai/createvisualizationjobhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func CreateVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CreateVisualizationJobReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewCreateVisualizationJobLogic(r.Context(), svcCtx) resp, err := l.CreateVisualizationJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/deletealgorithmhandler.go b/api/internal/handler/ai/deletealgorithmhandler.go index 57630af0..74597272 100644 --- a/api/internal/handler/ai/deletealgorithmhandler.go +++ b/api/internal/handler/ai/deletealgorithmhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func DeleteAlgorithmHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteAlgorithmReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewDeleteAlgorithmLogic(r.Context(), svcCtx) resp, err := l.DeleteAlgorithm(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/deletedatasethandler.go b/api/internal/handler/ai/deletedatasethandler.go index 84288d1c..7457bee0 100644 --- a/api/internal/handler/ai/deletedatasethandler.go +++ b/api/internal/handler/ai/deletedatasethandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func DeleteDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteDataSetReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewDeleteDataSetLogic(r.Context(), svcCtx) resp, err := l.DeleteDataSet(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/deleteservicehandler.go b/api/internal/handler/ai/deleteservicehandler.go index effb9aad..b65826fb 100644 --- a/api/internal/handler/ai/deleteservicehandler.go +++ b/api/internal/handler/ai/deleteservicehandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func DeleteServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteServiceReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewDeleteServiceLogic(r.Context(), svcCtx) resp, err := l.DeleteService(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/deletetrainingjobhandler.go b/api/internal/handler/ai/deletetrainingjobhandler.go index d0666ef7..ae789acb 100644 --- a/api/internal/handler/ai/deletetrainingjobhandler.go +++ b/api/internal/handler/ai/deletetrainingjobhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func DeleteTrainingJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteTrainingJobReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewDeleteTrainingJobLogic(r.Context(), svcCtx) resp, err := l.DeleteTrainingJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/getexporttasksofdatasethandler.go b/api/internal/handler/ai/getexporttasksofdatasethandler.go index bf45832a..f500affd 100644 --- a/api/internal/handler/ai/getexporttasksofdatasethandler.go +++ b/api/internal/handler/ai/getexporttasksofdatasethandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func GetExportTasksOfDatasetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.GetExportTasksOfDatasetReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewGetExportTasksOfDatasetLogic(r.Context(), svcCtx) resp, err := l.GetExportTasksOfDataset(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go b/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go index 3a7c0337..eb41f009 100644 --- a/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go +++ b/api/internal/handler/ai/getexporttaskstatusofdatasethandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func GetExportTaskStatusOfDatasetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.GetExportTaskStatusOfDatasetReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewGetExportTaskStatusOfDatasetLogic(r.Context(), svcCtx) resp, err := l.GetExportTaskStatusOfDataset(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/getlisttrainingjobshandler.go b/api/internal/handler/ai/getlisttrainingjobshandler.go index 3f978dba..51002c46 100644 --- a/api/internal/handler/ai/getlisttrainingjobshandler.go +++ b/api/internal/handler/ai/getlisttrainingjobshandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func GetListTrainingJobsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ListTrainingJobsreq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewGetListTrainingJobsLogic(r.Context(), svcCtx) resp, err := l.GetListTrainingJobs(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/getnotebookstoragehandler.go b/api/internal/handler/ai/getnotebookstoragehandler.go index 2c7618c8..9d7de093 100644 --- a/api/internal/handler/ai/getnotebookstoragehandler.go +++ b/api/internal/handler/ai/getnotebookstoragehandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func GetNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.GetNotebookStorageReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewGetNotebookStorageLogic(r.Context(), svcCtx) resp, err := l.GetNotebookStorage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/getvisualizationjobhandler.go b/api/internal/handler/ai/getvisualizationjobhandler.go index 51f41ed1..629b9707 100644 --- a/api/internal/handler/ai/getvisualizationjobhandler.go +++ b/api/internal/handler/ai/getvisualizationjobhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func GetVisualizationJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.GetVisualizationJobReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewGetVisualizationJobLogic(r.Context(), svcCtx) resp, err := l.GetVisualizationJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/listalgorithmshandler.go b/api/internal/handler/ai/listalgorithmshandler.go index 56c2ded7..9e3b0035 100644 --- a/api/internal/handler/ai/listalgorithmshandler.go +++ b/api/internal/handler/ai/listalgorithmshandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ListAlgorithmsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ListAlgorithmsReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewListAlgorithmsLogic(r.Context(), svcCtx) resp, err := l.ListAlgorithms(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/listclustershandler.go b/api/internal/handler/ai/listclustershandler.go index 50ad73bd..261d2512 100644 --- a/api/internal/handler/ai/listclustershandler.go +++ b/api/internal/handler/ai/listclustershandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ListClustersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ListClustersReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewListClustersLogic(r.Context(), svcCtx) resp, err := l.ListClusters(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/listdatasethandler.go b/api/internal/handler/ai/listdatasethandler.go index 78f06ffa..bb134718 100644 --- a/api/internal/handler/ai/listdatasethandler.go +++ b/api/internal/handler/ai/listdatasethandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ListDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DataSetReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewListDataSetLogic(r.Context(), svcCtx) resp, err := l.ListDataSet(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/listimporthandler.go b/api/internal/handler/ai/listimporthandler.go index 32a8c6d0..2faa5689 100644 --- a/api/internal/handler/ai/listimporthandler.go +++ b/api/internal/handler/ai/listimporthandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ListImportHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ListImportTasksReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewListImportLogic(r.Context(), svcCtx) resp, err := l.ListImport(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/listnotebookhandler.go b/api/internal/handler/ai/listnotebookhandler.go index b1375aeb..a8da51d5 100644 --- a/api/internal/handler/ai/listnotebookhandler.go +++ b/api/internal/handler/ai/listnotebookhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ListNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ListNotebookReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewListNotebookLogic(r.Context(), svcCtx) resp, err := l.ListNotebook(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/listserviceshandler.go b/api/internal/handler/ai/listserviceshandler.go index df823191..0f2266a6 100644 --- a/api/internal/handler/ai/listserviceshandler.go +++ b/api/internal/handler/ai/listserviceshandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ListServicesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ListServicesReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewListServicesLogic(r.Context(), svcCtx) resp, err := l.ListServices(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/mountnotebookstoragehandler.go b/api/internal/handler/ai/mountnotebookstoragehandler.go index 324c9708..3b1ac77d 100644 --- a/api/internal/handler/ai/mountnotebookstoragehandler.go +++ b/api/internal/handler/ai/mountnotebookstoragehandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func MountNotebookStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.MountNotebookStorageReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewMountNotebookStorageLogic(r.Context(), svcCtx) resp, err := l.MountNotebookStorage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/showalgorithmbyuuidhandler.go b/api/internal/handler/ai/showalgorithmbyuuidhandler.go index a2951560..73bdde4f 100644 --- a/api/internal/handler/ai/showalgorithmbyuuidhandler.go +++ b/api/internal/handler/ai/showalgorithmbyuuidhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ShowAlgorithmByUuidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ShowAlgorithmByUuidReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewShowAlgorithmByUuidLogic(r.Context(), svcCtx) resp, err := l.ShowAlgorithmByUuid(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/showservicehandler.go b/api/internal/handler/ai/showservicehandler.go index d6a9f4b4..c63b177f 100644 --- a/api/internal/handler/ai/showservicehandler.go +++ b/api/internal/handler/ai/showservicehandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ShowServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ShowServiceReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewShowServiceLogic(r.Context(), svcCtx) resp, err := l.ShowService(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/startnotebookhandler.go b/api/internal/handler/ai/startnotebookhandler.go index 1416d911..39706c24 100644 --- a/api/internal/handler/ai/startnotebookhandler.go +++ b/api/internal/handler/ai/startnotebookhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func StartNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.StartNotebookReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewStartNotebookLogic(r.Context(), svcCtx) resp, err := l.StartNotebook(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/ai/stopnotebookhandler.go b/api/internal/handler/ai/stopnotebookhandler.go index b6fd7cce..4fc89e79 100644 --- a/api/internal/handler/ai/stopnotebookhandler.go +++ b/api/internal/handler/ai/stopnotebookhandler.go @@ -1,28 +1,24 @@ package ai import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/ai" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func StopNotebookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.StopNotebookReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := ai.NewStopNotebookLogic(r.Context(), svcCtx) resp, err := l.StopNotebook(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/appdetailhandler.go b/api/internal/handler/apps/appdetailhandler.go index d668a226..926c813d 100644 --- a/api/internal/handler/apps/appdetailhandler.go +++ b/api/internal/handler/apps/appdetailhandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func AppDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AppDetailReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewAppDetailLogic(r.Context(), svcCtx) resp, err := l.AppDetail(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/applisthandler.go b/api/internal/handler/apps/applisthandler.go index 823cb985..831302e9 100644 --- a/api/internal/handler/apps/applisthandler.go +++ b/api/internal/handler/apps/applisthandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func AppListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AppListReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewAppListLogic(r.Context(), svcCtx) resp, err := l.AppList(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/apppodshandler.go b/api/internal/handler/apps/apppodshandler.go index ef3e0466..606af91e 100644 --- a/api/internal/handler/apps/apppodshandler.go +++ b/api/internal/handler/apps/apppodshandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func AppPodsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AppDetailReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewAppPodsLogic(r.Context(), svcCtx) resp, err := l.AppPods(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/deleteappbyappnamehandler.go b/api/internal/handler/apps/deleteappbyappnamehandler.go index a6c9efa6..65aebb78 100644 --- a/api/internal/handler/apps/deleteappbyappnamehandler.go +++ b/api/internal/handler/apps/deleteappbyappnamehandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func DeleteAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteAppReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewDeleteAppByAppNameLogic(r.Context(), svcCtx) resp, err := l.DeleteAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/getappbyappnamehandler.go b/api/internal/handler/apps/getappbyappnamehandler.go index d7dd16c2..47877edd 100644 --- a/api/internal/handler/apps/getappbyappnamehandler.go +++ b/api/internal/handler/apps/getappbyappnamehandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func GetAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.AppDetailReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewGetAppByAppNameLogic(r.Context(), svcCtx) resp, err := l.GetAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/pauseappbyappnamehandler.go b/api/internal/handler/apps/pauseappbyappnamehandler.go index a53de1ab..40f727b1 100644 --- a/api/internal/handler/apps/pauseappbyappnamehandler.go +++ b/api/internal/handler/apps/pauseappbyappnamehandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func PauseAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteAppReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewPauseAppByAppNameLogic(r.Context(), svcCtx) resp, err := l.PauseAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/restartappbyappnamehandler.go b/api/internal/handler/apps/restartappbyappnamehandler.go index 94b246af..7e1be056 100644 --- a/api/internal/handler/apps/restartappbyappnamehandler.go +++ b/api/internal/handler/apps/restartappbyappnamehandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func RestartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteAppReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewRestartAppByAppNameLogic(r.Context(), svcCtx) resp, err := l.RestartAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/startappbyappnamehandler.go b/api/internal/handler/apps/startappbyappnamehandler.go index 02b6a98b..f49a2529 100644 --- a/api/internal/handler/apps/startappbyappnamehandler.go +++ b/api/internal/handler/apps/startappbyappnamehandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func StartAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteAppReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewStartAppByAppNameLogic(r.Context(), svcCtx) resp, err := l.StartAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/apps/updateappbyappnamehandler.go b/api/internal/handler/apps/updateappbyappnamehandler.go index e72740b8..bf77676b 100644 --- a/api/internal/handler/apps/updateappbyappnamehandler.go +++ b/api/internal/handler/apps/updateappbyappnamehandler.go @@ -1,28 +1,24 @@ package apps import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/apps" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func UpdateAppByAppNameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteAppReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := apps.NewUpdateAppByAppNameLogic(r.Context(), svcCtx) resp, err := l.UpdateAppByAppName(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/cloud/cloudlisthandler.go b/api/internal/handler/cloud/cloudlisthandler.go index 22c759c4..524dc511 100644 --- a/api/internal/handler/cloud/cloudlisthandler.go +++ b/api/internal/handler/cloud/cloudlisthandler.go @@ -1,21 +1,16 @@ package cloud import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func CloudListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := cloud.NewCloudListLogic(r.Context(), svcCtx) resp, err := l.CloudList() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/cloud/controllermetricshandler.go b/api/internal/handler/cloud/controllermetricshandler.go index 2e02cf43..83aa7595 100644 --- a/api/internal/handler/cloud/controllermetricshandler.go +++ b/api/internal/handler/cloud/controllermetricshandler.go @@ -1,28 +1,24 @@ package cloud import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ControllerMetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ControllerMetricsReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := cloud.NewControllerMetricsLogic(r.Context(), svcCtx) resp, err := l.ControllerMetrics(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/cloud/deleteclusterhandler.go b/api/internal/handler/cloud/deleteclusterhandler.go index 323c25f3..7c27c7d0 100644 --- a/api/internal/handler/cloud/deleteclusterhandler.go +++ b/api/internal/handler/cloud/deleteclusterhandler.go @@ -1,28 +1,24 @@ package cloud import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func DeleteClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DeleteClusterReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := cloud.NewDeleteClusterLogic(r.Context(), svcCtx) resp, err := l.DeleteCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/cloud/deleteyamlhandler.go b/api/internal/handler/cloud/deleteyamlhandler.go index 60a01556..d4eb7b7b 100644 --- a/api/internal/handler/cloud/deleteyamlhandler.go +++ b/api/internal/handler/cloud/deleteyamlhandler.go @@ -1,28 +1,24 @@ package cloud import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func DeleteYamlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ApplyReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := cloud.NewDeleteYamlLogic(r.Context(), svcCtx) resp, err := l.DeleteYaml(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/cloud/getclusterlisthandler.go b/api/internal/handler/cloud/getclusterlisthandler.go index cc04e75d..0363e174 100644 --- a/api/internal/handler/cloud/getclusterlisthandler.go +++ b/api/internal/handler/cloud/getclusterlisthandler.go @@ -1,28 +1,24 @@ package cloud import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func GetClusterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.GetClusterListReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := cloud.NewGetClusterListLogic(r.Context(), svcCtx) resp, err := l.GetClusterList(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/cloud/noticetenanthandler.go b/api/internal/handler/cloud/noticetenanthandler.go index 9b3fea29..89a510ed 100644 --- a/api/internal/handler/cloud/noticetenanthandler.go +++ b/api/internal/handler/cloud/noticetenanthandler.go @@ -1,21 +1,16 @@ package cloud import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func NoticeTenantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := cloud.NewNoticeTenantLogic(r.Context(), svcCtx) resp, err := l.NoticeTenant() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/cloud/registerclusterhandler.go b/api/internal/handler/cloud/registerclusterhandler.go index f222e5be..54deafb0 100644 --- a/api/internal/handler/cloud/registerclusterhandler.go +++ b/api/internal/handler/cloud/registerclusterhandler.go @@ -1,28 +1,24 @@ package cloud import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func RegisterClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.RegisterClusterReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := cloud.NewRegisterClusterLogic(r.Context(), svcCtx) resp, err := l.RegisterCluster(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/cloud/updatetenanthandler.go b/api/internal/handler/cloud/updatetenanthandler.go index 04b04e32..e1f69de5 100644 --- a/api/internal/handler/cloud/updatetenanthandler.go +++ b/api/internal/handler/cloud/updatetenanthandler.go @@ -1,28 +1,24 @@ package cloud import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/cloud" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func UpdateTenantHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.UpdateTenantReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := cloud.NewUpdateTenantLogic(r.Context(), svcCtx) resp, err := l.UpdateTenant(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/core/centerresourceshandler.go b/api/internal/handler/core/centerresourceshandler.go index c8ff2014..31aef57b 100644 --- a/api/internal/handler/core/centerresourceshandler.go +++ b/api/internal/handler/core/centerresourceshandler.go @@ -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 { diff --git a/api/internal/handler/core/committaskhandler.go b/api/internal/handler/core/committaskhandler.go index 1930c2d0..b0642b7c 100644 --- a/api/internal/handler/core/committaskhandler.go +++ b/api/internal/handler/core/committaskhandler.go @@ -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 } diff --git a/api/internal/handler/core/commitvmtasktemphandler.go b/api/internal/handler/core/commitvmtasktemphandler.go new file mode 100644 index 00000000..6167ba5c --- /dev/null +++ b/api/internal/handler/core/commitvmtasktemphandler.go @@ -0,0 +1,28 @@ +package core + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" +) + +func CommitVmTaskTempHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CommitVmTaskReq + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := core.NewCommitVmTaskTempLogic(r.Context(), svcCtx) + resp, err := l.CommitVmTaskTemp(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/api/internal/handler/core/deletetaskhandler.go b/api/internal/handler/core/deletetaskhandler.go index 08430798..b922b88b 100644 --- a/api/internal/handler/core/deletetaskhandler.go +++ b/api/internal/handler/core/deletetaskhandler.go @@ -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 } diff --git a/api/internal/handler/core/getcomputilitystatisticshandler.go b/api/internal/handler/core/getcomputilitystatisticshandler.go index 51d91b8e..06183c83 100644 --- a/api/internal/handler/core/getcomputilitystatisticshandler.go +++ b/api/internal/handler/core/getcomputilitystatisticshandler.go @@ -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) } } diff --git a/api/internal/handler/core/getcomputingpowerhandler.go b/api/internal/handler/core/getcomputingpowerhandler.go index 09ea3475..9f031ac0 100644 --- a/api/internal/handler/core/getcomputingpowerhandler.go +++ b/api/internal/handler/core/getcomputingpowerhandler.go @@ -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) } } diff --git a/api/internal/handler/core/getgeneralinfohandler.go b/api/internal/handler/core/getgeneralinfohandler.go index 87febd89..614e1954 100644 --- a/api/internal/handler/core/getgeneralinfohandler.go +++ b/api/internal/handler/core/getgeneralinfohandler.go @@ -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) } } diff --git a/api/internal/handler/core/getregionhandler.go b/api/internal/handler/core/getregionhandler.go index 5e639d9f..3b884280 100644 --- a/api/internal/handler/core/getregionhandler.go +++ b/api/internal/handler/core/getregionhandler.go @@ -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) } } diff --git a/api/internal/handler/core/getresourcepanelconfighandler.go b/api/internal/handler/core/getresourcepanelconfighandler.go index 36942c2f..bc84d068 100644 --- a/api/internal/handler/core/getresourcepanelconfighandler.go +++ b/api/internal/handler/core/getresourcepanelconfighandler.go @@ -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 { diff --git a/api/internal/handler/core/jobtotalhandler.go b/api/internal/handler/core/jobtotalhandler.go index 8e31d97b..0d59f6bc 100644 --- a/api/internal/handler/core/jobtotalhandler.go +++ b/api/internal/handler/core/jobtotalhandler.go @@ -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 { diff --git a/api/internal/handler/core/listcenterhandler.go b/api/internal/handler/core/listcenterhandler.go index c9697a8b..0c7b8c4f 100644 --- a/api/internal/handler/core/listcenterhandler.go +++ b/api/internal/handler/core/listcenterhandler.go @@ -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) } } diff --git a/api/internal/handler/core/listclusterhandler.go b/api/internal/handler/core/listclusterhandler.go index a4a923ab..96fa7279 100644 --- a/api/internal/handler/core/listclusterhandler.go +++ b/api/internal/handler/core/listclusterhandler.go @@ -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) } } diff --git a/api/internal/handler/core/listdomainresourcehandler.go b/api/internal/handler/core/listdomainresourcehandler.go new file mode 100644 index 00000000..e69de29b diff --git a/api/internal/handler/core/listregionhandler.go b/api/internal/handler/core/listregionhandler.go index cfb1b1ab..80d60ef8 100644 --- a/api/internal/handler/core/listregionhandler.go +++ b/api/internal/handler/core/listregionhandler.go @@ -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) } } diff --git a/api/internal/handler/core/metricshandler.go b/api/internal/handler/core/metricshandler.go index fb157525..b3ca8b79 100644 --- a/api/internal/handler/core/metricshandler.go +++ b/api/internal/handler/core/metricshandler.go @@ -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) + } } diff --git a/api/internal/handler/core/nodeassetshandler.go b/api/internal/handler/core/nodeassetshandler.go index 21b4afde..9117fb16 100644 --- a/api/internal/handler/core/nodeassetshandler.go +++ b/api/internal/handler/core/nodeassetshandler.go @@ -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 { diff --git a/api/internal/handler/core/participantlisthandler.go b/api/internal/handler/core/participantlisthandler.go index 2a306381..c6795eef 100644 --- a/api/internal/handler/core/participantlisthandler.go +++ b/api/internal/handler/core/participantlisthandler.go @@ -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 { diff --git a/api/internal/handler/core/pulltaskinfohandler.go b/api/internal/handler/core/pulltaskinfohandler.go index e1777968..ed98c682 100644 --- a/api/internal/handler/core/pulltaskinfohandler.go +++ b/api/internal/handler/core/pulltaskinfohandler.go @@ -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 { diff --git a/api/internal/handler/core/putresourcepanelconfighandler.go b/api/internal/handler/core/putresourcepanelconfighandler.go index 8b45e55a..0700c6cd 100644 --- a/api/internal/handler/core/putresourcepanelconfighandler.go +++ b/api/internal/handler/core/putresourcepanelconfighandler.go @@ -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 { diff --git a/api/internal/handler/core/scheduletaskbyyamlhandler.go b/api/internal/handler/core/scheduletaskbyyamlhandler.go index e597ad66..c3447137 100644 --- a/api/internal/handler/core/scheduletaskbyyamlhandler.go +++ b/api/internal/handler/core/scheduletaskbyyamlhandler.go @@ -1,17 +1,3 @@ -/* - - Copyright (c) [2023] [pcm] - [pcm-coordinator] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - -*/ - package core import ( diff --git a/api/internal/handler/core/syncclusterloadhandler.go b/api/internal/handler/core/syncclusterloadhandler.go index cd8de3a3..da5f6f1b 100644 --- a/api/internal/handler/core/syncclusterloadhandler.go +++ b/api/internal/handler/core/syncclusterloadhandler.go @@ -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 } diff --git a/api/internal/handler/core/taskdetailhandler.go b/api/internal/handler/core/taskdetailhandler.go index f4325530..646bbe43 100644 --- a/api/internal/handler/core/taskdetailhandler.go +++ b/api/internal/handler/core/taskdetailhandler.go @@ -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 } diff --git a/api/internal/handler/core/tasklisthandler.go b/api/internal/handler/core/tasklisthandler.go index 18a7ad80..3a16cb02 100644 --- a/api/internal/handler/core/tasklisthandler.go +++ b/api/internal/handler/core/tasklisthandler.go @@ -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) } } diff --git a/api/internal/handler/hpc/commithpctaskhandler.go b/api/internal/handler/hpc/commithpctaskhandler.go index a2043def..7408b559 100644 --- a/api/internal/handler/hpc/commithpctaskhandler.go +++ b/api/internal/handler/hpc/commithpctaskhandler.go @@ -1,28 +1,24 @@ package hpc import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func CommitHpcTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CommitHpcTaskReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := hpc.NewCommitHpcTaskLogic(r.Context(), svcCtx) resp, err := l.CommitHpcTask(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/hpc/listhistoryjobhandler.go b/api/internal/handler/hpc/listhistoryjobhandler.go index ec50c854..f37ce3fc 100644 --- a/api/internal/handler/hpc/listhistoryjobhandler.go +++ b/api/internal/handler/hpc/listhistoryjobhandler.go @@ -1,28 +1,24 @@ package hpc import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ListHistoryJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ListHistoryJobReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := hpc.NewListHistoryJobLogic(r.Context(), svcCtx) resp, err := l.ListHistoryJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/hpc/listjobhandler.go b/api/internal/handler/hpc/listjobhandler.go index c9572a7e..53a3b782 100644 --- a/api/internal/handler/hpc/listjobhandler.go +++ b/api/internal/handler/hpc/listjobhandler.go @@ -1,28 +1,24 @@ package hpc import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ListJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ListJobReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := hpc.NewListJobLogic(r.Context(), svcCtx) resp, err := l.ListJob(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/hpc/queueassetshandler.go b/api/internal/handler/hpc/queueassetshandler.go index 97c0c5d4..135d88bd 100644 --- a/api/internal/handler/hpc/queueassetshandler.go +++ b/api/internal/handler/hpc/queueassetshandler.go @@ -1,21 +1,16 @@ package hpc import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/hpc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func QueueAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := hpc.NewQueueAssetsLogic(r.Context(), svcCtx) resp, err := l.QueueAssets() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/image/chunkhandler.go b/api/internal/handler/image/chunkhandler.go index 87c8b143..5d87cd8c 100644 --- a/api/internal/handler/image/chunkhandler.go +++ b/api/internal/handler/image/chunkhandler.go @@ -1,21 +1,16 @@ package image import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ChunkHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := image.NewChunkLogic(r.Context(), svcCtx) err := l.Chunk() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } + result.HttpResult(r, w, nil, err) } } diff --git a/api/internal/handler/image/datasetcheckhandler.go b/api/internal/handler/image/datasetcheckhandler.go index b127987b..74803223 100644 --- a/api/internal/handler/image/datasetcheckhandler.go +++ b/api/internal/handler/image/datasetcheckhandler.go @@ -1,28 +1,24 @@ package image import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func DataSetCheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CheckReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := image.NewDataSetCheckLogic(r.Context(), svcCtx) resp, err := l.DataSetCheck(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/image/imagelisthandler.go b/api/internal/handler/image/imagelisthandler.go index cbd14726..b2dea764 100644 --- a/api/internal/handler/image/imagelisthandler.go +++ b/api/internal/handler/image/imagelisthandler.go @@ -1,21 +1,16 @@ package image import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ImageListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := image.NewImageListLogic(r.Context(), svcCtx) resp, err := l.ImageList() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/image/uploaddatasethandler.go b/api/internal/handler/image/uploaddatasethandler.go index ffe715c6..27b2eb9a 100644 --- a/api/internal/handler/image/uploaddatasethandler.go +++ b/api/internal/handler/image/uploaddatasethandler.go @@ -1,21 +1,16 @@ package image import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func UploadDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := image.NewUploadDataSetLogic(r.Context(), svcCtx) err := l.UploadDataSet() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } + result.HttpResult(r, w, nil, err) } } diff --git a/api/internal/handler/image/uploadhandler.go b/api/internal/handler/image/uploadhandler.go index 66cd4592..bfc73030 100644 --- a/api/internal/handler/image/uploadhandler.go +++ b/api/internal/handler/image/uploadhandler.go @@ -1,21 +1,16 @@ package image import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/image" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func UploadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := image.NewUploadLogic(r.Context(), svcCtx) err := l.Upload() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.Ok(w) - } + result.HttpResult(r, w, nil, err) } } diff --git a/api/internal/handler/routes.go b/api/internal/handler/routes.go index 25a9f9a4..665a5b28 100644 --- a/api/internal/handler/routes.go +++ b/api/internal/handler/routes.go @@ -44,6 +44,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { Path: "/core/commitVmTask", Handler: core.CommitVmTaskHandler(serverCtx), }, + { + Method: http.MethodPost, + Path: "/core/commitVmTaskTemp", + Handler: core.CommitVmTaskTempHandler(serverCtx), + }, { Method: http.MethodDelete, Path: "/core/deleteTask/:id", @@ -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"), ) diff --git a/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go b/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go index 430786f2..82b876ae 100644 --- a/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go +++ b/api/internal/handler/schedule/schedulegetairesourcetypeshandler.go @@ -1,21 +1,16 @@ package schedule import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ScheduleGetAiResourceTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := schedule.NewScheduleGetAiResourceTypesLogic(r.Context(), svcCtx) resp, err := l.ScheduleGetAiResourceTypes() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/schedule/schedulegetaitasktypeshandler.go b/api/internal/handler/schedule/schedulegetaitasktypeshandler.go index 5be11070..db45b9c5 100644 --- a/api/internal/handler/schedule/schedulegetaitasktypeshandler.go +++ b/api/internal/handler/schedule/schedulegetaitasktypeshandler.go @@ -1,21 +1,16 @@ package schedule import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ScheduleGetAiTaskTypesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := schedule.NewScheduleGetAiTaskTypesLogic(r.Context(), svcCtx) resp, err := l.ScheduleGetAiTaskTypes() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/schedule/schedulegetdatasetshandler.go b/api/internal/handler/schedule/schedulegetdatasetshandler.go index da285546..5dc32bb7 100644 --- a/api/internal/handler/schedule/schedulegetdatasetshandler.go +++ b/api/internal/handler/schedule/schedulegetdatasetshandler.go @@ -1,21 +1,16 @@ package schedule import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ScheduleGetDatasetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := schedule.NewScheduleGetDatasetsLogic(r.Context(), svcCtx) resp, err := l.ScheduleGetDatasets() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/schedule/schedulegetstrategyhandler.go b/api/internal/handler/schedule/schedulegetstrategyhandler.go index 2ee88fba..4771495c 100644 --- a/api/internal/handler/schedule/schedulegetstrategyhandler.go +++ b/api/internal/handler/schedule/schedulegetstrategyhandler.go @@ -1,21 +1,16 @@ package schedule import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ScheduleGetStrategyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { l := schedule.NewScheduleGetStrategyLogic(r.Context(), svcCtx) resp, err := l.ScheduleGetStrategy() - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/schedule/schedulesubmithandler.go b/api/internal/handler/schedule/schedulesubmithandler.go index a536f649..d6e2a538 100644 --- a/api/internal/handler/schedule/schedulesubmithandler.go +++ b/api/internal/handler/schedule/schedulesubmithandler.go @@ -1,28 +1,24 @@ package schedule import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/schedule" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ScheduleSubmitHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ScheduleReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := schedule.NewScheduleSubmitLogic(r.Context(), svcCtx) resp, err := l.ScheduleSubmit(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/storage/dailypowerscreenhandler.go b/api/internal/handler/storage/dailypowerscreenhandler.go index 48844f39..878a536c 100644 --- a/api/internal/handler/storage/dailypowerscreenhandler.go +++ b/api/internal/handler/storage/dailypowerscreenhandler.go @@ -1,28 +1,24 @@ package storage import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storage" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func DailyPowerScreenHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DailyPowerScreenReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := storage.NewDailyPowerScreenLogic(r.Context(), svcCtx) resp, err := l.DailyPowerScreen(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/storage/percentercomputerpowershandler.go b/api/internal/handler/storage/percentercomputerpowershandler.go index 2e1b5f78..15c7d3a1 100644 --- a/api/internal/handler/storage/percentercomputerpowershandler.go +++ b/api/internal/handler/storage/percentercomputerpowershandler.go @@ -1,28 +1,24 @@ package storage import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storage" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func PerCenterComputerPowersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.PerCenterComputerPowersReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := storage.NewPerCenterComputerPowersLogic(r.Context(), svcCtx) resp, err := l.PerCenterComputerPowers(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/handler/storage/screenstoragehandler.go b/api/internal/handler/storage/screenstoragehandler.go index 8a8a2bec..2a6d8901 100644 --- a/api/internal/handler/storage/screenstoragehandler.go +++ b/api/internal/handler/storage/screenstoragehandler.go @@ -1,28 +1,24 @@ package storage import ( - "net/http" - "github.com/zeromicro/go-zero/rest/httpx" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/storage" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" + "net/http" ) func ScreenStorageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.StorageScreenReq if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) + result.ParamErrorResult(r, w, err) return } l := storage.NewScreenStorageLogic(r.Context(), svcCtx) resp, err := l.ScreenStorage(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } + result.HttpResult(r, w, resp, err) } } diff --git a/api/internal/logic/adapters/getadapterrelationlogic.go b/api/internal/logic/adapters/getadapterrelationlogic.go index c2e21e44..afc6952b 100644 --- a/api/internal/logic/adapters/getadapterrelationlogic.go +++ b/api/internal/logic/adapters/getadapterrelationlogic.go @@ -24,7 +24,7 @@ func NewGetAdapterRelationLogic(ctx context.Context, svcCtx *svc.ServiceContext) } } -func (l *GetAdapterRelationLogic) GetAdapterRelation(req *types.AdapterQueryReq) (resp *types.PageResult, err error) { +func (l *GetAdapterRelationLogic) GetAdapterRelation(req *types.AdapterRelationQueryReq) (resp *types.PageResult, err error) { resp = &types.PageResult{} var list []types.AdapterInfo db := l.svcCtx.DbEngin.Model(&types.AdapterInfo{}).Table("t_adapter") diff --git a/api/internal/logic/adapters/getclustersumlogic.go b/api/internal/logic/adapters/getclustersumlogic.go index 0659e3e1..4a934fed 100644 --- a/api/internal/logic/adapters/getclustersumlogic.go +++ b/api/internal/logic/adapters/getclustersumlogic.go @@ -28,7 +28,8 @@ func (l *GetClusterSumLogic) GetClusterSum(req *types.ClusterSumReq) (resp *type resp = &types.ClusterSumReqResp{} var AdapterSum int // - var ClusterSum int // + var podSum int // + var vmSum int // var TaskSum int // // sqlStr := "SELECT COUNT(*) FROM `t_adapter` t where t.type = 0" @@ -37,12 +38,19 @@ func (l *GetClusterSumLogic) GetClusterSum(req *types.ClusterSumReq) (resp *type logx.Error(err) return nil, tx.Error } - // - sqlStrCluster := "SELECT COUNT(*) FROM `t_cluster`t where t.label ='openstack' || t.label='kubernetes'\n" - txCluster := l.svcCtx.DbEngin.Raw(sqlStrCluster).Scan(&ClusterSum) - if txCluster.Error != nil { + //vm + sqlStrVm := "SELECT COUNT(*) FROM `t_adapter` t left join t_cluster tc on t.id=tc.adapter_id where t.type='3' and tc.deleted_at is null" + txClusterVm := l.svcCtx.DbEngin.Raw(sqlStrVm).Scan(&vmSum) + if txClusterVm.Error != nil { logx.Error(err) - return nil, txCluster.Error + return nil, txClusterVm.Error + } + //pod + sqlStrPod := "SELECT COUNT(*) FROM `t_adapter` t left join t_cluster tc on t.id=tc.adapter_id where t.type='0' and tc.deleted_at is null" + txClusterPod := l.svcCtx.DbEngin.Raw(sqlStrPod).Scan(&podSum) + if txClusterPod.Error != nil { + logx.Error(err) + return nil, txClusterPod.Error } // sqlStrTask := "SELECT COUNT(*) FROM `task`" @@ -52,7 +60,8 @@ func (l *GetClusterSumLogic) GetClusterSum(req *types.ClusterSumReq) (resp *type return nil, txTask.Error } resp.TaskSum = TaskSum - resp.ClusterSum = ClusterSum + resp.VmSum = vmSum + resp.PodSum = podSum resp.AdapterSum = AdapterSum return resp, nil } diff --git a/api/internal/logic/core/commitvmtasklogic.go b/api/internal/logic/core/commitvmtasklogic.go index 5d803bf2..4b81af55 100644 --- a/api/internal/logic/core/commitvmtasklogic.go +++ b/api/internal/logic/core/commitvmtasklogic.go @@ -8,6 +8,7 @@ import ( "gitlink.org.cn/JointCloud/pcm-coordinator/api/pkg/response" "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants" "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models" + tool "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils" "time" "github.com/zeromicro/go-zero/core/logx" @@ -41,14 +42,15 @@ func (l *CommitVmTaskLogic) CommitVmTask(req *types.CommitVmTaskReq) (resp *type if tx.Error != nil { return nil, tx.Error } - /* hpc := models.Hpc{} - tool.Convert(req, &hpc)*/ + vm := models.Vm{} + tool.Convert(req, &vm) mqInfo := response.TaskInfo{ TaskId: taskModel.Id, TaskType: "vm", MatchLabels: req.MatchLabels, NsID: req.NsID, } + //req.TaskId = taskModel.Id mqs.InsQueue.Beta.Add(&mqInfo) return } diff --git a/api/internal/logic/core/commitvmtasktemplogic.go b/api/internal/logic/core/commitvmtasktemplogic.go new file mode 100644 index 00000000..f9501d46 --- /dev/null +++ b/api/internal/logic/core/commitvmtasktemplogic.go @@ -0,0 +1,30 @@ +package core + +import ( + "context" + + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types" + + "github.com/zeromicro/go-zero/core/logx" +) + +type CommitVmTaskTempLogic struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func NewCommitVmTaskTempLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommitVmTaskTempLogic { + return &CommitVmTaskTempLogic{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *CommitVmTaskTempLogic) CommitVmTaskTemp(req *types.CommitVmTaskReq) (resp *types.CommitVmTaskResp, err error) { + // todo: add your logic here and delete this line + + return +} diff --git a/api/internal/logic/core/pulltaskinfologic.go b/api/internal/logic/core/pulltaskinfologic.go index 438475d4..bc152ddc 100644 --- a/api/internal/logic/core/pulltaskinfologic.go +++ b/api/internal/logic/core/pulltaskinfologic.go @@ -27,26 +27,12 @@ func NewPullTaskInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Pull } func (l *PullTaskInfoLogic) PullTaskInfo(req *clientCore.PullTaskInfoReq) (*clientCore.PullTaskInfoResp, error) { - //opt := clientPCM.Options{ - // Url: "http://localhost:8999", - // DataSource: "root:uJpLd6u-J?HC1@(47.92.88.143:3306)/pcm?parseTime=true&loc=Local", - //} - //coreCli, _ := clientPCM.NewClient(opt) - //taskOpt := clientPCM.TaskOptions{} - //coreTask, _ := coreCli.Task(taskOpt) - //adapterId := 1706858330967773111 - //// 查询core端分发下来的任务列表 - //pullReq := types.PullTaskInfoReq{ - // AdapterId: int64(adapterId), - //} - //hpcList, _ := coreTask.PullTaskInfo(pullReq) - //println(hpcList) - // 查询p端类型 resp := clientCore.PullTaskInfoResp{} + // check the kind of adapter var kind int32 l.svcCtx.DbEngin.Raw("select type as kind from `t_adapter` where id = ?", req.AdapterId).Scan(&kind) - // 查询云智超中的数据列表 + // pull task list from database switch kind { case 2: var hpcModelList []models.TaskHpc @@ -85,8 +71,9 @@ func (l *PullTaskInfoLogic) PullTaskInfo(req *clientCore.PullTaskInfoReq) (*clie return &resp, nil } -func findModelList(participantId int64, dbEngin *gorm.DB, data interface{}) error { - tx := dbEngin.Where("cluster_id = (select id from t_cluster where adapter_id = ?) AND status NOT IN ?", participantId, []string{"Deleted", "Succeeded", "Completed", "Failed"}).Find(data) +func findModelList(adapterId int64, dbEngin *gorm.DB, data interface{}) error { + tx := dbEngin.Where("cluster_id in (select id from t_cluster where adapter_id = ?) AND status not in "+ + "('Deleted', 'Succeeded', 'COMPLETED', 'Completed', 'Failed','FAIL','statC','statE')", adapterId).Find(data) if tx.Error != nil { return tx.Error } diff --git a/api/internal/logic/core/pushtaskinfologic.go b/api/internal/logic/core/pushtaskinfologic.go index 6a882aee..2944711d 100644 --- a/api/internal/logic/core/pushtaskinfologic.go +++ b/api/internal/logic/core/pushtaskinfologic.go @@ -40,7 +40,7 @@ func (l *PushTaskInfoLogic) PushTaskInfo(req *clientCore.PushTaskInfoReq) (*clie case 2: for _, hpcInfo := range req.HpcInfoList { l.svcCtx.DbEngin.Exec("update task_hpc set status = ?,start_time = ?,job_id = ? where cluster_id = ? and task_id = ? and name = ?", - hpcInfo.Status, hpcInfo.StartTime, hpcInfo.RunningTime, hpcInfo.JobId, req.AdapterId, hpcInfo.TaskId, hpcInfo.Name) + hpcInfo.Status, hpcInfo.StartTime, hpcInfo.JobId, hpcInfo.ClusterId, hpcInfo.TaskId, hpcInfo.Name) syncTask(l.svcCtx.DbEngin, hpcInfo.TaskId) } case 1: diff --git a/api/internal/logic/hpc/commithpctasklogic.go b/api/internal/logic/hpc/commithpctasklogic.go index d8827ce9..6211a13d 100644 --- a/api/internal/logic/hpc/commithpctasklogic.go +++ b/api/internal/logic/hpc/commithpctasklogic.go @@ -5,6 +5,7 @@ import ( "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/constants" "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/models" "k8s.io/apimachinery/pkg/util/json" + "math/rand" "time" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" @@ -28,6 +29,7 @@ func NewCommitHpcTaskLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Com } func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *types.CommitHpcTaskResp, err error) { + // 构建主任务结构体 taskModel := models.Task{ Status: constants.Saved, @@ -41,10 +43,18 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t return nil, tx.Error } + var clusterIds []int64 + l.svcCtx.DbEngin.Raw("SELECT id FROM `t_cluster` where adapter_id = ? and label = ?", req.AdapterId, req.ClusterType).Scan(&clusterIds) + env, _ := json.Marshal(req.Environment) + + if len(clusterIds) == 0 || clusterIds == nil { + return nil, nil + } + hpcInfo := models.TaskHpc{ TaskId: taskModel.Id, - ClusterId: 1706858330967773111, + ClusterId: clusterIds[rand.Intn(len(clusterIds))], Name: taskModel.Name, Status: "Saved", CmdScript: req.CmdScript, @@ -61,9 +71,9 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t StdErrFile: req.StdErrFile, StdInput: req.StdInput, DeletedFlag: 0, - CreatedBy: req.ParticipantId, + CreatedBy: 0, CreatedTime: time.Now(), - UpdatedBy: req.ParticipantId, + UpdatedBy: 0, UpdatedTime: time.Now(), Environment: string(env), } @@ -72,7 +82,7 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t if tx.Error != nil { return nil, tx.Error } - // 将任务数据转换成消息体 + // todo mq task manage //reqMessage, err := json.Marshal(mqInfo) //if err != nil { // logx.Error(err) @@ -82,5 +92,10 @@ func (l *CommitHpcTaskLogic) CommitHpcTask(req *types.CommitHpcTaskReq) (resp *t //if publish.Err() != nil { // return nil, publish.Err() //} - return + resp = &types.CommitHpcTaskResp{ + Code: 200, + Msg: "success", + TaskId: taskModel.Id, + } + return resp, nil } diff --git a/api/internal/logic/vm/getimagenumlogic.go b/api/internal/logic/vm/getimagenumlogic.go index eac511af..24f763d2 100644 --- a/api/internal/logic/vm/getimagenumlogic.go +++ b/api/internal/logic/vm/getimagenumlogic.go @@ -3,11 +3,9 @@ package vm import ( "context" "fmt" - "github.com/jinzhu/copier" "github.com/pkg/errors" "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr" "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result" - "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils" "gitlink.org.cn/JointCloud/pcm-openstack/openstack" "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc" @@ -33,9 +31,10 @@ func NewGetImageNumLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetIm func (l *GetImageNumLogic) GetImageNum(req *types.ListImagesReq) (resp *types.ImageNum, err error) { // todo: add your logic here and delete this line resp = &types.ImageNum{} - ListImagesReq := &openstack.ListImagesReq{} - err = copier.CopyWithOption(ListImagesReq, req, copier.Option{Converters: utils.Converters}) - ListImagesResp, err := l.svcCtx.OpenstackRpc.ListImages(l.ctx, ListImagesReq) + listImagesReq := &openstack.ListImagesReq{} + listImagesReq.Platform = req.Platform + //err = copier.CopyWithOption(ListImagesReq, req, copier.Option{Converters: utils.Converters}) + ListImagesResp, err := l.svcCtx.OpenstackRpc.ListImages(l.ctx, listImagesReq) if err != nil { return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get Networks list"), "Failed to get db Servers list err : %v ,req:%+v", err, req) } diff --git a/api/internal/logic/vm/getnetworknumlogic.go b/api/internal/logic/vm/getnetworknumlogic.go index 65084eba..0d785b1c 100644 --- a/api/internal/logic/vm/getnetworknumlogic.go +++ b/api/internal/logic/vm/getnetworknumlogic.go @@ -2,7 +2,6 @@ package vm import ( "context" - "fmt" "github.com/jinzhu/copier" "github.com/pkg/errors" "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/xerr" @@ -41,7 +40,6 @@ func (l *GetNetworkNumLogic) GetNetworkNum(req *types.ListNetworksReq) (resp *ty } var count int = len(ListNetworksResp.Networks) resp.NetworkNum = int32(count) - fmt.Println(count) if err != nil { return nil, result.NewDefaultError(err.Error()) } diff --git a/api/internal/scheduler/algorithm/weightDistributing/weightDistributing.go b/api/internal/scheduler/algorithm/weightDistributing/weightDistributing.go new file mode 100644 index 00000000..0124fa8b --- /dev/null +++ b/api/internal/scheduler/algorithm/weightDistributing/weightDistributing.go @@ -0,0 +1,68 @@ +package weightDistributing + +import ( + "math" +) + +type Weight struct { + Id int64 + Weight int32 + Name string + Replica int32 +} + +func DistributeReplicas(weights []*Weight, replicas int32) { + var weightSum int32 + weightSum = 0 + for _, w := range weights { + weightSum += w.Weight + } + + weightRatio := make([]float64, len(weights)) + for i, w := range weights { + weightRatio[i] = float64(w.Weight) / float64(weightSum) + } + + var rest = replicas + + for i := 0; i < len(weights); i++ { + + var n = math.Round(float64(replicas) * weightRatio[i]) + rest -= int32(n) + + weights[i].Replica = int32(n) + } + + for { + if rest == 0 { + break + } + + maxIdx := 0 + minIdx := 0 + + if rest > 0 { + for i, ratio := range weightRatio { + if ratio > weightRatio[maxIdx] { + maxIdx = i + } + } + } else { + for i, ratio := range weightRatio { + if ratio < weightRatio[minIdx] { + minIdx = i + } + } + } + + if rest > 0 { + weights[maxIdx].Replica++ + weightRatio[maxIdx]-- + rest-- + } else { + weights[minIdx].Replica-- + weightRatio[minIdx]++ + rest++ + } + } +} diff --git a/api/internal/scheduler/entity/entity.go b/api/internal/scheduler/entity/entity.go index 7f5f6951..33e48dba 100644 --- a/api/internal/scheduler/entity/entity.go +++ b/api/internal/scheduler/entity/entity.go @@ -11,9 +11,3 @@ type Participant struct { Name string Participant_id int64 } - -type WeightP struct { - Participant_id int64 - Weight int32 - Name string -} diff --git a/api/internal/scheduler/schedulers/aiScheduler.go b/api/internal/scheduler/schedulers/aiScheduler.go index 2d5518fa..3ac52d10 100644 --- a/api/internal/scheduler/schedulers/aiScheduler.go +++ b/api/internal/scheduler/schedulers/aiScheduler.go @@ -61,12 +61,17 @@ func (as *AiScheduler) PickOptimalStrategy() (strategy.Strategy, error) { if len(resources) == 0 { return nil, errors.New("no cluster has resources") } - params := ¶m.Params{Resources: resources} if len(resources) == 1 { - return &strategy.SingleAssignment{Cluster: &strategy.AssignedCluster{ParticipantId: 0, Name: "", Replicas: 1}}, nil + var cluster strategy.AssignedCluster + cluster.ParticipantId = resources[0].ParticipantId + cluster.Name = resources[0].Name + cluster.Replicas = 1 + return &strategy.SingleAssignment{Cluster: &cluster}, nil } + params := ¶m.Params{Resources: resources} + switch as.option.StrategyName { case strategy.REPLICATION: strategy := strategy.NewReplicationStrategy(¶m.ReplicationParams{Params: params, Replicas: 1}) @@ -75,7 +80,11 @@ func (as *AiScheduler) PickOptimalStrategy() (strategy.Strategy, error) { strategy := strategy.NewPricingStrategy(¶m.ResourcePricingParams{Params: params, Replicas: 1}) return strategy, nil case strategy.DYNAMIC_RESOURCES: - strategy := strategy.NewDynamicResourcesStrategy(resources, as.option, 1) + strategy := strategy.NewDynamicResourcesStrategy(params.Resources, as.option, 1) + return strategy, nil + case strategy.STATIC_WEIGHT: + //todo resources should match cluster StaticWeightMap + strategy := strategy.NewStaticWeightStrategy(as.option.ClusterToStaticWeight, 1) return strategy, nil } diff --git a/api/internal/scheduler/service/collector/collector.go b/api/internal/scheduler/service/collector/collector.go index c6e68851..b4d66c68 100644 --- a/api/internal/scheduler/service/collector/collector.go +++ b/api/internal/scheduler/service/collector/collector.go @@ -9,8 +9,11 @@ type ResourceStats struct { ParticipantId int64 Name string CpuCoreAvail int64 + CpuCoreTotal int64 MemAvail float64 + MemTotal float64 DiskAvail float64 + DiskTotal float64 GpuAvail int64 CardsAvail []*Card CpuCoreHours float64 @@ -23,7 +26,7 @@ type Card struct { Name string TOpsAtFp16 float64 CardHours float64 - Num int32 + CardNum int32 } type DatasetsSpecs struct { diff --git a/api/internal/scheduler/strategy/dynamicResources.go b/api/internal/scheduler/strategy/dynamicResources.go index ea528311..c8d4052f 100644 --- a/api/internal/scheduler/strategy/dynamicResources.go +++ b/api/internal/scheduler/strategy/dynamicResources.go @@ -28,10 +28,10 @@ func (ps *DynamicResourcesStrategy) Schedule() ([]*AssignedCluster, error) { var maxCardHoursAvailable float64 var maxCpuCoreHoursAvailable float64 - var assignedCluster *AssignedCluster + var assignedCluster AssignedCluster var results []*AssignedCluster for _, res := range ps.resources { - if opt.ResourceType == "" { + if opt.ResourceType == "cpu" { if res.CpuCoreHours <= 0 { cluster := &AssignedCluster{ParticipantId: res.ParticipantId, Name: res.Name, Replicas: ps.replicas} results = append(results, cluster) @@ -46,7 +46,7 @@ func (ps *DynamicResourcesStrategy) Schedule() ([]*AssignedCluster, error) { } } - if opt.ResourceType == "" { + if opt.ResourceType == "computeCard" { var maxCurrentCardHours float64 for _, card := range res.CardsAvail { cardHours := common.RoundFloat(card.TOpsAtFp16*card.CardHours, 3) @@ -62,7 +62,7 @@ func (ps *DynamicResourcesStrategy) Schedule() ([]*AssignedCluster, error) { } } } - results = append(results, assignedCluster) + results = append(results, &assignedCluster) return results, nil } diff --git a/api/internal/scheduler/strategy/staticWeight.go b/api/internal/scheduler/strategy/staticWeight.go index 76230ca3..2172bec3 100644 --- a/api/internal/scheduler/strategy/staticWeight.go +++ b/api/internal/scheduler/strategy/staticWeight.go @@ -2,73 +2,45 @@ package strategy import ( "errors" - "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/scheduler/entity" + "gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/scheduler/algorithm/weightDistributing" ) type StaticWeightStrategy struct { - // TODO: add fields - - //每个 - num int32 - weights []entity.WeightP + staticWeightMap map[string]int32 + replicas int32 } -func NewStaticWeightStrategy(weights []entity.WeightP, replicas int32) *StaticWeightStrategy { - return &StaticWeightStrategy{weights: weights, - num: replicas, +func NewStaticWeightStrategy(staticWeightMap map[string]int32, replicas int32) *StaticWeightStrategy { + return &StaticWeightStrategy{staticWeightMap: staticWeightMap, + replicas: replicas, } } -func (ps *StaticWeightStrategy) Schedule() ([]*AssignedCluster, error) { - // TODO: implement the scheduling logic return nil, nil +func (s *StaticWeightStrategy) Schedule() ([]*AssignedCluster, error) { - if ps.num < 1 { - return nil, errors.New("numbers must be greater than 0") + if s.replicas < 1 { + return nil, errors.New("replicas must be greater than 0") } - if ps.weights == nil { + if len(s.staticWeightMap) == 0 || s.staticWeightMap == nil { return nil, errors.New("weight must be set") } - var weightSum int32 - weightSum = 0 - for _, w := range ps.weights { - weightSum += w.Weight - } - - weightRatio := make([]float64, len(ps.weights)) - for i, w := range ps.weights { - weightRatio[i] = float64(w.Weight) / float64(weightSum) - } - - var rest = ps.num - var results []*AssignedCluster - - for i := 0; i < len(ps.weights); i++ { - - var n = int(float64(ps.num) * weightRatio[i]) - rest -= int32(n) - - cluster := &AssignedCluster{ParticipantId: ps.weights[i].Participant_id, Name: ps.weights[i].Name, Replicas: int32(n)} - results = append(results, cluster) - } - - if rest != 0 { - if rest < 0 { // 如果差值小于0,需要增加某些元素的值 - for i := len(ps.weights) - 1; rest < 0 && i >= 0; i-- { - if results[i].Replicas < ps.weights[i].Weight { - results[i].Replicas++ - rest++ - } - } - } else { - for i := len(ps.weights) - 1; rest > 0 && i >= 0; i-- { - if results[i].Replicas < ps.weights[i].Weight { - results[i].Replicas-- - rest-- - } - } + weights := make([]*weightDistributing.Weight, 0) + for k, v := range s.staticWeightMap { + weight := &weightDistributing.Weight{ + Name: k, + Weight: v, } + weights = append(weights, weight) + } + + weightDistributing.DistributeReplicas(weights, s.replicas) + + var results []*AssignedCluster + for _, weight := range weights { + cluster := &AssignedCluster{ParticipantId: weight.Id, Name: weight.Name, Replicas: weight.Replica} + results = append(results, cluster) } return results, nil diff --git a/api/internal/scheduler/strategy/test/strategy_test.go b/api/internal/scheduler/strategy/test/strategy_test.go index d2cb9fb1..eb0f59ad 100644 --- a/api/internal/scheduler/strategy/test/strategy_test.go +++ b/api/internal/scheduler/strategy/test/strategy_test.go @@ -63,15 +63,15 @@ func TestReplication(t *testing.T) { } func TestStaticWeight(t *testing.T) { - parts := []entity.WeightP{ - {Name: "p1", Participant_id: 1, Weight: 3}, - {Name: "p2", Participant_id: 2, Weight: 5}, - {Name: "p3", Participant_id: 3, Weight: 2}, + parts := map[string]int32{ + "test1": 6, + "test2": 5, + "test3": 2, } tests := []struct { name string replica int32 - ps []entity.WeightP + ps map[string]int32 }{ { name: "test1", diff --git a/api/internal/storeLink/shuguangai.go b/api/internal/storeLink/shuguangai.go index 63a43cf9..f44466fe 100644 --- a/api/internal/storeLink/shuguangai.go +++ b/api/internal/storeLink/shuguangai.go @@ -45,6 +45,7 @@ const ( TRAIN_FILE = "train.py" CPUCOREPRICEPERHOUR = 0.09 DCUPRICEPERHOUR = 2.0 + KB = 1024 ) var RESOURCESGAIMAP = map[string]ResourceSpecSGAI{ @@ -272,17 +273,25 @@ func (s *ShuguangAi) GetResourceStats() (*collector.ResourceStats, error) { return nil, err } - //limitReq := &hpcAC.QueueReq{} - //limitResp, err := s.svcCtx.ACRpc.QueryUserQuotasLimit(s.ctx, limitReq) - //if err != nil { - // return nil, err - //} + limitReq := &hpcAC.QueueReq{} + limitResp, err := s.svcCtx.ACRpc.QueryUserQuotasLimit(s.ctx, limitReq) + if err != nil { + return nil, err + } + totalCpu := limitResp.Data.AccountMaxCpu + totalDcu := limitResp.Data.AccountMaxDcu - //diskReq := &hpcAC.ParaStorQuotaReq{} - //diskResp, err := s.svcCtx.ACRpc.ParaStorQuota(s.ctx, diskReq) - //if err != nil { - // return nil, err - //} + diskReq := &hpcAC.ParaStorQuotaReq{} + diskResp, err := s.svcCtx.ACRpc.ParaStorQuota(s.ctx, diskReq) + if err != nil { + return nil, err + } + + totalDisk := common.RoundFloat(diskResp.Data[0].Threshold*KB*KB, 3) + availDisk := common.RoundFloat((diskResp.Data[0].Threshold-diskResp.Data[0].Usage)*KB*KB, 3) + + generalInfo, err := s.svcCtx.ACRpc.GetGeneralInfo(s.ctx, nil) + memSize := common.RoundFloat(float64(generalInfo.MemoryInGib)*KB*KB, 3) var cards []*collector.Card balance, _ := strconv.ParseFloat(userinfo.Data.AccountBalance, 64) @@ -295,14 +304,21 @@ func (s *ShuguangAi) GetResourceStats() (*collector.ResourceStats, error) { Name: DCU, TOpsAtFp16: DCU_TOPS, CardHours: cardHours, + CardNum: int32(totalDcu), } cards = append(cards, dcu) resourceStats := &collector.ResourceStats{ ParticipantId: s.participantId, Name: s.platform, Balance: balance, - CardsAvail: cards, + CpuCoreTotal: totalCpu, + CpuCoreAvail: 0, + DiskTotal: totalDisk, + DiskAvail: availDisk, + MemTotal: memSize, + MemAvail: 0, CpuCoreHours: cpuHours, + CardsAvail: cards, } return resourceStats, nil diff --git a/api/internal/types/types.go b/api/internal/types/types.go index ac65c847..cf0a72c6 100644 --- a/api/internal/types/types.go +++ b/api/internal/types/types.go @@ -116,7 +116,7 @@ type CommitVmTaskReq struct { NsID string `json:"nsID"` Replicas int64 `json:"replicas,optional"` MatchLabels map[string]string `json:"matchLabels,optional"` - Server []ServerCommit `json:"server,optional"` + Servers []ServerCommit `json:"servers,optional"` Platform string `json:"platform,optional"` } @@ -520,6 +520,15 @@ type AdapterQueryReq struct { PageInfo } +type AdapterRelationQueryReq struct { + Id string `form:"id,optional" db:"id"` + Name string `form:"name,optional"` + Type string `form:"type,optional"` + Nickname string `form:"nickname,optional"` + Version string `form:"version,optional"` + Server string `form:"server,optional"` +} + type AdapterReq struct { Id string `json:"id,optional" db:"id"` Name string `json:"name,optional"` @@ -663,7 +672,8 @@ type ClusterSumReq struct { } type ClusterSumReqResp struct { - ClusterSum int `json:"ClusterSum,omitempty"` + PodSum int `json:"podSum,omitempty"` + VmSum int `json:"vmSum,omitempty"` AdapterSum int `json:"AdapterSum,omitempty"` TaskSum int `json:"TaskSum,omitempty"` } @@ -834,29 +844,32 @@ type Job struct { } type CommitHpcTaskReq struct { - Name string `json:"name"` // paratera:jobName - Description string `json:"description,optional"` - TenantId int64 `json:"tenantId,optional"` - TaskId int64 `json:"taskId,optional"` - ParticipantId int64 `json:"participantId,optional"` - MatchLabels map[string]string `json:"matchLabels,optional"` - CardCount int64 `json:"cardCount,optional"` - WorkDir string `json:"workDir,optional"` //paratera:workingDir - WallTime string `json:"wallTime,optional"` - CmdScript string `json:"cmdScript,optional"` // paratera:bootScript - AppType string `json:"appType,optional"` - AppName string `json:"appName,optional"` // paratera:jobGroupName ac:appname - Queue string `json:"queue,optional"` - NNode string `json:"nNode,optional"` - SubmitType string `json:"submitType,optional"` - StdOutFile string `json:"stdOutFile,optional"` - StdErrFile string `json:"stdErrFile,optional"` - StdInput string `json:"stdInput,optional"` - Environment map[string]string `json:"environment,optional"` + Name string `json:"name"` // paratera:jobName + Description string `json:"description,optional"` + TenantId int64 `json:"tenantId,optional"` + TaskId int64 `json:"taskId,optional"` + AdapterId int64 `json:"adapterId,optional"` + 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 struct { - TaskId int64 `json:"taskId"` + TaskId int64 `json:"taskId"` + Code int32 `json:"code"` + Msg string `json:"msg"` } type ListJobReq struct { @@ -2571,7 +2584,7 @@ type Limits struct { } type GetComputeLimitsReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type GetComputeLimitsResp struct { @@ -2603,7 +2616,7 @@ type VolumeLimits struct { } type GetVolumeLimitsReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type GetVolumeLimitsResp struct { @@ -2616,7 +2629,7 @@ type GetVolumeLimitsResp struct { type ListServersReq struct { Limit int32 `form:"limit,optional"` OffSet int32 `form:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListServersResp struct { @@ -2645,7 +2658,7 @@ type Servers_links struct { } type ListServersDetailedReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListServersDetailedResp struct { @@ -2669,7 +2682,7 @@ type ServersDetailed struct { type GetServersDetailedByIdReq struct { ServerId string `form:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type GetServersDetailedByIdResp struct { @@ -2757,7 +2770,7 @@ type ExtraSpecs struct { type UpdateServerReq struct { ServerId string `form:"server_id" copier:"ServerId"` ServerUpdate ServerUpdate `json:"server_update" copier:"ServerUpdate"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ServerUpdate struct { @@ -2775,7 +2788,7 @@ type StartServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"action,optional" copier:"Action"` Start_action string `json:"start_action" copier:"start_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type StartServerResp struct { @@ -2788,7 +2801,7 @@ type StopServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"action,optional" copier:"Action"` Stop_action string `json:"stop_action" copier:"stop_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type StopServerResp struct { @@ -2800,7 +2813,7 @@ type StopServerResp struct { type RebootServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Reboot Reboot `json:"reboot" copier:"Reboot"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type RebootServerResp struct { @@ -2817,7 +2830,7 @@ type PauseServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` Pause_action string `json:"pause_action" copier:"pause_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type PauseServerResp struct { @@ -2830,7 +2843,7 @@ type UnpauseServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` Unpause_action string `json:"unpause_action" copier:"unpause_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type UnpauseServerResp struct { @@ -2841,7 +2854,7 @@ type UnpauseServerResp struct { type DeleteServerReq struct { ServerId string `form:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type DeleteServerResp struct { @@ -2863,11 +2876,14 @@ type CreateServerResp struct { } type Server struct { + AvailabilityZone string `json:"availability_zone" copier:"AvailabilityZone"` Name string `json:"name,optional" copier:"Name"` FlavorRef string `json:"flavorRef,optional" copier:"FlavorRef"` + Description string `json:"description,optional" copier:"Description"` ImageRef string `json:"imageRef,optional" copier:"ImageRef"` Networks []CreNetwork `json:"networks,optional" copier:"Networks"` BlockDeviceMappingV2 []Block_device_mapping_v2 `json:"block_device_mapping_v2,optional" copier:"BlockDeviceMappingV2"` + MinCount int32 `json:"min_count,optional" copier:"MinCount"` } type CreNetwork struct { @@ -2896,7 +2912,7 @@ type ServerResp struct { type RebuildServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` Rebuild Rebuild `json:"rebuild" copier:"Rebuild"` } @@ -2971,7 +2987,7 @@ type ShelveServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` Shelve_action string `json:"shelve_action" copier:"shelve_action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ShelveServerResp struct { @@ -2982,7 +2998,7 @@ type ShelveServerResp struct { type RescueServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` Rescue Rescue `json:"rescue" copier:"Rescue"` } @@ -3000,7 +3016,7 @@ type Rescue struct { type UnRescueServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` UnRescue_action string `json:"UnRescue_action" copier:"UnRescue_action"` Rescue Rescue `json:"rescue" copier:"Rescue"` } @@ -3014,7 +3030,7 @@ type UnRescueServerResp struct { type ChangeAdministrativePasswordReq struct { ServerId string `json:"server_id" copier:"ServerId"` Changepassword string `json:"changePassword" copier:"Changepassword"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` ChangePassword ChangePassword `json:"changepassword" copier:"ChangePassword"` } @@ -3031,7 +3047,7 @@ type ChangePassword struct { type SuspendServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` UnRescue_action string `json:"UnRescue_action" copier:"UnRescue_action"` Rescue Rescue `json:"rescue" copier:"Rescue"` } @@ -3045,7 +3061,7 @@ type SuspendServerResp struct { type AddSecurityGroupToServerReq struct { ServerId string `json:"server_id" copier:"ServerId"` Action []map[string]string `json:"Action,optional" copier:"Action"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` UnRescue_action string `json:"UnRescue_action" copier:"UnRescue_action"` AddSecurityGroup AddSecurityGroup `json:"addSecurityGroup" copier:"AddSecurityGroup"` } @@ -3062,7 +3078,7 @@ type AddSecurityGroup struct { type RemoveSecurityGroupReq struct { ServerId string `json:"server_id" copier:"ServerId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` RemoveSecurityGroup RemoveSecurityGroup `json:"removeSecurityGroup" copier:"RemoveSecurityGroup"` } @@ -3098,7 +3114,7 @@ type FlavorServer struct { } type DeleteFlavorReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` ServerId string `json:"server_id" copier:"ServerId"` FlavorId string `json:"flavor_id" copier:"FlavorId"` } @@ -3110,8 +3126,7 @@ type DeleteFlavorResp struct { } type ListImagesReq struct { - Limit int32 `form:"limit,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListImagesResp struct { @@ -3181,7 +3196,7 @@ type CreateImageResp struct { type UploadOsImageReq struct { ImageId string `form:"image_id" copier:"ImageId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type UploadOsImageResp struct { @@ -3192,7 +3207,7 @@ type UploadOsImageResp struct { type DeleteImageReq struct { ImageId string `form:"image_id" copier:"ImageId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type DeleteImageResp struct { @@ -3216,7 +3231,7 @@ type ImageNum struct { } type ListNetworksReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListNetworksResp struct { @@ -3237,7 +3252,7 @@ type Network struct { Ipv6AddressScope string `json:"ipv6_address_scope,optional" copier:"Ipv6AddressScope"` L2Adjacency bool `json:"l2_adjacency,optional" copier:"L2Adjacency"` Mtu int64 `json:"mtu,optional" copier:"Mtu"` - Name string `json:",optional" copier:"Name"` + Name string `json:"name,optional" copier:"Name"` PortSecurityEnabled bool `json:"port_security_enabled,optional" copier:"PortSecurityEnabled"` ProjectId string `json:"project_id,optional" copier:"ProjectId"` QosPolicyId string `json:"qos_policy_id,optional" copier:"QosPolicyId"` @@ -3256,7 +3271,7 @@ type Network struct { type DeleteNetworkReq struct { NetworkId string `form:"network_id" copier:"NetworkId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type DeleteNetworkResp struct { @@ -3340,7 +3355,7 @@ type Allocation_pools struct { type ShowNetworkDetailsReq struct { NetworkId string `form:"network_id" copier:"NetworkId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ShowNetworkDetailsResp struct { @@ -3379,7 +3394,7 @@ type Networkdetail struct { type UpdateNetworkReq struct { NetworkId string `form:"network_id" copier:"NetworkId"` Network Network `json:"network" copier:"Network"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type UpdateNetworkResp struct { @@ -3404,7 +3419,7 @@ type BulkCreateNetworksResp struct { type ListSubnetsReq struct { Limit int32 `json:"limit,optional"` OffSet int32 `json:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListSubnetsResp struct { @@ -3446,7 +3461,7 @@ type Allocation_pool struct { type DeleteSubnetReq struct { SubnetId string `json:"subnet_id,optional" copier:"subnetId"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type DeleteSubnetResp struct { @@ -3457,7 +3472,7 @@ type DeleteSubnetResp struct { type UpdateSubnetReq struct { SubnetId string `json:"subnet_id,optional" copier:"subnetId"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type UpdateSubnetResp struct { @@ -3502,7 +3517,7 @@ type Used struct { type ListNetworkSegmentRangesReq struct { Limit int32 `json:"limit,optional"` OffSet int32 `json:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListNetworkSegmentRangesResp struct { @@ -3532,7 +3547,7 @@ type Network_segment_ranges struct { type DeleteNetworkSegmentRangesReq struct { Network_segment_range_id string `json:"network_segment_range_id,optional" copier:"network_segment_range_id"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type DeleteNetworkSegmentRangesResp struct { @@ -3544,7 +3559,7 @@ type DeleteNetworkSegmentRangesResp struct { type UpdateNetworkSegmentRangesReq struct { Network_segment_range_id string `json:"network_segment_range_id,optional" copier:"network_segment_range_id"` NetworkSegmentRange Network_segment_range `json:"network_segment_range,optional" copier:"NetworkSegmentRange"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type UpdateNetworkSegmentRangesResp struct { @@ -3616,7 +3631,7 @@ type CreatePortResp struct { type ListPortsReq struct { Limit int32 `json:"limit,optional"` OffSet int32 `json:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListPortsResp struct { @@ -3675,7 +3690,7 @@ type Fixed_ips struct { type DeletePortReq struct { Port_id string `json:"port_id,optional" copier:"port_id"` - Platform string `json:"platform,optional" copier:"platform"` + Platform string `form:"platform,optional" copier:"platform"` } type DeletePortResp struct { @@ -3687,7 +3702,7 @@ type DeletePortResp struct { type UpdatePortReq struct { Port_id string `json:"port_id,optional" copier:"port_id"` Port Port `json:"port,optional" copier:"port"` - Platform string `json:"platform,optional" copier:"platform"` + Platform string `form:"platform,optional" copier:"platform"` } type UpdatePortResp struct { @@ -3700,7 +3715,7 @@ type UpdatePortResp struct { type ShowPortDetailsReq struct { Port_id string `json:"port_id,optional" copier:"port_id"` Fields string `json:"fields,optional" copier:"fields"` - Platform string `json:"platform,optional" copier:"platform"` + Platform string `form:"platform,optional" copier:"platform"` } type ShowPortDetailsResp struct { @@ -3713,7 +3728,7 @@ type ShowPortDetailsResp struct { type ListRoutersReq struct { Limit int32 `json:"limit,optional"` OffSet int32 `json:"offSet,optional"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListRoutersResp struct { @@ -3807,7 +3822,7 @@ type Router struct { type UpdateRouterReq struct { Router Router `json:"router,optional" copier:"router"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type UpdateRouterResp struct { @@ -3819,7 +3834,7 @@ type UpdateRouterResp struct { type ShowRouterDetailsReq struct { Router Router `json:"router,optional" copier:"router"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type ShowRouterDetailsResp struct { @@ -3830,7 +3845,7 @@ type ShowRouterDetailsResp struct { } type DeleteRouterReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Router_id string `json:"router_id,optional" copier:"router_id"` } @@ -3841,7 +3856,7 @@ type DeleteRouterResp struct { } type ListFloatingIPsReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Limit int32 `json:"limit,optional" copier:"Limit"` OffSet int32 `json:"offSet,optional" copier:"OffSet"` } @@ -3928,7 +3943,7 @@ type Floatingip struct { } type UpdateFloatingIPReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Floatingip_id string `json:"floatingip_id,optional" copier:"floatingip_id"` Floatingip Floatingip `json:"floatingip,optional" copier:"floatingip"` } @@ -3941,7 +3956,7 @@ type UpdateFloatingIPResp struct { } type DeleteFloatingIPReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Floatingip_id string `json:"floatingip_id,optional" copier:"floatingip_id"` } @@ -3964,7 +3979,7 @@ type ShowFloatingIPDetailsResp struct { } type ListFirewallGroupsReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Fields string `json:"fields,optional" copier:"fields"` } @@ -3991,7 +4006,7 @@ type Firewall_groups struct { type DeleteFirewallGroupReq struct { Firewall_group_id string `json:"firewall_group_id,optional" copier:"firewall_group_id"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type DeleteFirewallGroupResp struct { @@ -4028,7 +4043,7 @@ type Firewall_group struct { type UpdateFirewallGroupReq struct { Firewall_group Firewall_group `json:"firewall_group,optional" copier:"firewall_group"` - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Firewall_group_id string `json:"firewall_group_id,optional" copier:"firewall_group_id"` } @@ -4040,7 +4055,7 @@ type UpdateFirewallGroupResp struct { } type ShowFirewallGroupDetailsReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Firewall_group_id string `json:"firewall_group_id,optional" copier:"firewall_group_id"` } @@ -4075,7 +4090,7 @@ type Firewall_policy struct { } type DeleteFirewallPolicyReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Firewall_policy_id string `json:"firewall_policy_id,optional" copier:"firewall_policy_id"` } @@ -4086,7 +4101,7 @@ type DeleteFirewallPolicyResp struct { } type ListFirewallPoliciesReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Fields string `json:"fields,optional" copier:"fields"` } @@ -4152,7 +4167,7 @@ type Firewall_rule struct { } type DeleteFirewallRuleReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Firewall_rule_id string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"` } @@ -4163,7 +4178,7 @@ type DeleteFirewallRuleResp struct { } type ListFirewallRulesReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Fields string `json:"fields,optional" copier:"fields"` } @@ -4194,7 +4209,7 @@ type Firewall_rules struct { } type ShowFirewallRuleDetailsReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Firewall_rule_id string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"` } @@ -4206,7 +4221,7 @@ type ShowFirewallRuleDetailsResp struct { } type ListSecurityGroupsReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Fields string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"` } @@ -4232,7 +4247,7 @@ type Security_groups struct { } type CreateSecurityGroupReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Firewall_rule_id string `json:"firewall_rule_id,optional" copier:"firewall_rule_id"` } @@ -4279,7 +4294,7 @@ type Security_group_rules struct { } type DeleteSecurityGroupReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Security_group_id string `json:"security_group_id,optional" copier:"security_group_id"` } @@ -4290,7 +4305,7 @@ type DeleteSecurityGroupResp struct { } type UpdateSecurityGroupReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Security_group_id string `json:"security_group_id,optional" copier:"security_group_id"` } @@ -4302,7 +4317,7 @@ type UpdateSecurityGroupResp struct { } type ShowSecurityGroupReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Security_group_id string `json:"security_group_id,optional" copier:"security_group_id"` Fields string `json:"fields,optional" copier:"fields"` Verbose string `json:"verbose,optional" copier:"verbose"` @@ -4316,7 +4331,7 @@ type ShowSecurityGroupResp struct { } type ListSecurityGroupRulesReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` } type ListSecurityGroupRulesResp struct { @@ -4358,7 +4373,7 @@ type Security_group_rule struct { } type ShowSecurityGroupRuleReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Security_group_rule_id string `json:"security_group_rule_id,optional" copier:"security_group_rule_id"` } @@ -4370,7 +4385,7 @@ type ShowSecurityGroupRuleResp struct { } type DeleteSecurityGroupRuleReq struct { - Platform string `json:"platform,optional" copier:"Platform"` + Platform string `form:"platform,optional" copier:"Platform"` Security_group_rule_id string `json:"security_group_rule_id,optional" copier:"security_group_rule_id"` } @@ -4382,7 +4397,7 @@ type DeleteSecurityGroupRuleResp struct { } type ListVolumesDetailReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListVolumesDetailResp struct { @@ -4416,7 +4431,7 @@ type DeleteVolumeReq struct { VolumeId string `form:"volume_id" copier:"VolumeId"` Cascade bool `json:"cascade" copier:"Cascade"` Force bool `json:"force" copier:"force"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type DeleteVolumeResp struct { @@ -4466,7 +4481,7 @@ type VolumeResp struct { } type ListVolumeTypesReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListVolumeTypesResp struct { @@ -4493,7 +4508,7 @@ type Extra_specs struct { type UpdateVolumeReq struct { Volume Volume `json:"volume" copier:"Volume"` VolumeId string `json:"volume_id" copier:"VolumeId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type UpdateVolumeResp struct { @@ -4505,7 +4520,7 @@ type UpdateVolumeResp struct { type GetVolumeDetailedByIdReq struct { VolumeId string `form:"volume_id" copier:"VolumeId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type GetVolumeDetailedByIdResp struct { @@ -4557,7 +4572,7 @@ type VolumeType struct { type DeleteVolumeTypeReq struct { VolumeTypeId string `json:"volume_type_id" copier:"VolumeTypeId"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type DeleteVolumeTypeResp struct { @@ -4577,7 +4592,7 @@ type ListVolumesReq struct { CreatedAt string `json:"created_at" copier:"CreatedAt"` ConsumesQuota bool `json:"consumes_quota" copier:"ConsumesQuota"` UpdatedAt string `json:"updated_at" copier:"UpdatedAt"` - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListVolumesResp struct { @@ -4594,7 +4609,7 @@ type VolumesList struct { } type ListFlavorsDetailReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` } type ListFlavorsDetailResp struct { @@ -4619,7 +4634,7 @@ type Flavors struct { } type ListNodesReq struct { - Platform string `json:"platform,optional"` + Platform string `form:"platform,optional"` Limit int64 `json:"limit" copier:"Limit"` Marker string `json:"marker" copier:"Marker"` SortDir string `json:"sort_dir" copier:"SortDir"` @@ -5153,3 +5168,119 @@ type AiDatasetsResp struct { type AiStrategyResp struct { Strategies []string `json:"strategies"` } + +type PullTaskInfoReq struct { + AdapterId int64 `form:"adapterId"` +} + +type PullTaskInfoResp struct { + HpcInfoList []*HpcInfo `json:"HpcInfoList,omitempty"` + CloudInfoList []*CloudInfo `json:"CloudInfoList,omitempty"` + AiInfoList []*AiInfo `json:"AiInfoList,omitempty"` + VmInfoList []*VmInfo `json:"VmInfoList,omitempty"` +} + +type HpcInfo struct { + Id int64 `json:"id"` // id + TaskId int64 `json:"task_id"` // 任务id + JobId string `json:"job_id"` // 作业id(在第三方系统中的作业id) + ClusterId int64 `json:"cluster_id"` // 执行任务的集群id + ClusterType string `json:"cluster_type"` // 执行任务的集群类型 + Name string `json:"name"` // 名称 + Status string `json:"status"` // 状态 + CmdScript string `json:"cmd_script"` + StartTime string `json:"start_time"` // 开始时间 + RunningTime int64 `json:"running_time"` // 运行时间 + DerivedEs string `json:"derived_es"` + Cluster string `json:"cluster"` + BlockId int64 `json:"block_id"` + AllocNodes int64 `json:"alloc_nodes"` + AllocCpu int64 `json:"alloc_cpu"` + CardCount int64 `json:"card_count"` // 卡数 + Version string `json:"version"` + Account string `json:"account"` + WorkDir string `json:"work_dir"` // 工作路径 + AssocId int64 `json:"assoc_id"` + ExitCode int64 `json:"exit_code"` + WallTime string `json:"wall_time"` // 最大运行时间 + Result string `json:"result"` // 运行结果 + DeletedAt string `json:"deleted_at"` // 删除时间 + YamlString string `json:"yaml_string"` + AppType string `json:"app_type"` // 应用类型 + AppName string `json:"app_name"` // 应用名称 + Queue string `json:"queue"` // 队列名称 + SubmitType string `json:"submit_type"` // cmd(命令行模式) + NNode string `json:"n_node"` // 节点个数(当指定该参数时,GAP_NODE_STRING必须为"") + StdOutFile string `json:"std_out_file"` // 工作路径/std.err.%j + StdErrFile string `json:"std_err_file"` // 工作路径/std.err.%j + StdInput string `json:"std_input"` + Environment string `json:"environment"` + DeletedFlag int64 `json:"deleted_flag"` // 是否删除(0-否,1-是) + CreatedBy int64 `json:"created_by"` // 创建人 + CreatedTime string `json:"created_time"` // 创建时间 + UpdatedBy int64 `json:"updated_by"` // 更新人 + UpdatedTime string `json:"updated_time"` // 更新时间 +} + +type CloudInfo struct { + Participant int64 `json:"participant,omitempty"` + Id int64 `json:"id,omitempty"` + TaskId int64 `json:"taskId,omitempty"` + ApiVersion string `json:"apiVersion,omitempty"` + Kind string `json:"kind,omitempty"` + Namespace string `json:"namespace,omitempty"` + Name string `json:"name,omitempty"` + Status string `json:"status,omitempty"` + StartTime string `json:"startTime,omitempty"` + RunningTime int64 `json:"runningTime,omitempty"` + Result string `json:"result,omitempty"` + YamlString string `json:"yamlString,omitempty"` +} + +type AiInfo struct { + ParticipantId int64 `json:"participantId,omitempty"` + TaskId int64 `json:"taskId,omitempty"` + ProjectId string `json:"project_id,omitempty"` + Name string `json:"name,omitempty"` + Status string `json:"status,omitempty"` + StartTime string `json:"startTime,omitempty"` + RunningTime int64 `json:"runningTime,omitempty"` + Result string `json:"result,omitempty"` + JobId string `json:"jobId,omitempty"` + CreateTime string `json:"createTime,omitempty"` + ImageUrl string `json:"imageUrl,omitempty"` + Command string `json:"command,omitempty"` + FlavorId string `json:"flavorId,omitempty"` + SubscriptionId string `json:"subscriptionId,omitempty"` + ItemVersionId string `json:"itemVersionId,omitempty"` +} + +type VmInfo struct { + ParticipantId int64 `json:"participantId,omitempty"` + TaskId int64 `json:"taskId,omitempty"` + Name string `json:"name,omitempty"` + FlavorRef string `json:"flavor_ref,omitempty"` + ImageRef string `json:"image_ref,omitempty"` + NetworkUuid string `json:"network_uuid,omitempty"` + BlockUuid string `json:"block_uuid,omitempty"` + SourceType string `json:"source_type,omitempty"` + DeleteOnTermination bool `json:"delete_on_termination,omitempty"` + State string `json:"state,omitempty"` +} + +type PushTaskInfoReq struct { + AdapterId int64 `json:"adapterId"` + HpcInfoList []*HpcInfo `json:"hpcInfoList"` + CloudInfoList []*CloudInfo `json:"cloudInfoList"` + AiInfoList []*AiInfo `json:"aiInfoList"` + VmInfoList []*VmInfo `json:"vmInfoList"` +} + +type PushTaskInfoResp struct { + Code int64 `json:"code"` + Msg string `json:"msg"` +} + +type PushResourceInfoReq struct { + AdapterId int64 `json:"adapterId"` +} diff --git a/go.mod b/go.mod index 20445f33..f1fc4c62 100644 --- a/go.mod +++ b/go.mod @@ -45,16 +45,11 @@ require ( require ( github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/alecthomas/kingpin/v2 v2.4.0 // indirect - github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect github.com/alibabacloud-go/tea v1.1.17 // indirect github.com/alibabacloud-go/tea-utils v1.4.4 // indirect github.com/aliyun/alibabacloud-dkms-gcs-go-sdk v0.2.2 // indirect github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.7 // indirect - github.com/armon/go-metrics v0.3.10 // indirect - github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect - github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/buger/jsonparser v1.1.1 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect @@ -68,78 +63,43 @@ require ( github.com/docker/go-units v0.5.0 // indirect github.com/emicklei/go-restful/v3 v3.11.3 // indirect github.com/fatih/color v1.16.0 // indirect - github.com/go-kit/log v0.2.1 // indirect - github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-openapi/analysis v0.22.2 // indirect - github.com/go-openapi/errors v0.21.0 // indirect github.com/go-openapi/jsonpointer v0.20.3 // indirect github.com/go-openapi/jsonreference v0.20.5 // indirect - github.com/go-openapi/loads v0.21.5 // indirect - github.com/go-openapi/runtime v0.27.1 // indirect - github.com/go-openapi/spec v0.20.14 // indirect - github.com/go-openapi/strfmt v0.22.0 // indirect github.com/go-openapi/swag v0.22.10 // indirect - github.com/go-openapi/validate v0.23.0 // indirect - github.com/gofrs/uuid v4.4.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.0 // indirect github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.4 // indirect - github.com/google/btree v1.0.1 // indirect github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect - github.com/hashicorp/errwrap v1.1.0 // indirect - github.com/hashicorp/go-immutable-radix v1.3.1 // indirect - github.com/hashicorp/go-msgpack v0.5.3 // indirect - github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-sockaddr v1.0.6 // indirect - github.com/hashicorp/golang-lru v0.5.4 // indirect - github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect - github.com/hashicorp/memberlist v0.5.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect - github.com/jpillora/backoff v1.0.0 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/miekg/dns v1.1.41 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect - github.com/oklog/run v1.1.0 // indirect - github.com/oklog/ulid v1.3.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.0.2 // indirect - github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect github.com/pelletier/go-toml/v2 v2.1.1 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common/sigv4 v0.1.0 // indirect - github.com/prometheus/exporter-toolkit v0.11.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/redis/go-redis/v9 v9.5.1 // indirect - github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect - github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect - github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/xhit/go-str2duration/v2 v2.1.0 // indirect - github.com/xlab/treeprint v1.2.0 // indirect go.etcd.io/etcd/api/v3 v3.5.12 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.12 // indirect go.etcd.io/etcd/client/v3 v3.5.12 // indirect - go.mongodb.org/mongo-driver v1.13.1 // indirect go.opentelemetry.io/otel v1.24.0 // indirect go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect diff --git a/go.sum b/go.sum index cf7c30bb..ebd640ab 100644 --- a/go.sum +++ b/go.sum @@ -393,7 +393,6 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU= github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= -github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/JCCE-nudt/zero-contrib/zrpc/registry/nacos v0.0.0-20230419021610-13bbc83fbc3c h1:qoPu5FeE6dsvZ7AmH/l3Y5RxrJPNVKvsQSrjQpWUCMQ= github.com/JCCE-nudt/zero-contrib/zrpc/registry/nacos v0.0.0-20230419021610-13bbc83fbc3c/go.mod h1:GuCS4be9IH3bSBTvbzz34nszPQDO33PIOv5nviEaFMw= github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8afzqM= @@ -406,15 +405,11 @@ github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/sarama v1.37.2/go.mod h1:Nxye/E+YPru//Bpaorfhc3JsSGYwCaDDj+R4bK52U5o= github.com/Shopify/toxiproxy/v2 v2.5.0/go.mod h1:yhM2epWtAmel9CB8r2+L+PCmhH6yH2pITaPAo7jxJl0= -github.com/alecthomas/kingpin/v2 v2.4.0 h1:f48lwail6p8zpO1bC4TxtqACaGqHYA22qkHjHpqDjYY= -github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= -github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 h1:NqugFkGxx1TXSh/pBcU00Y6bljgDPaFdh5MUSeJ7e50= github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68/go.mod h1:6pb/Qy8c+lqua8cFpEy7g39NRRqOWc3rOwAy8m5Y2BY= github.com/alibabacloud-go/tea v1.1.0/go.mod h1:IkGyUSX4Ba1V+k4pCtJUc6jDpZLFph9QMy2VUPTwukg= @@ -436,19 +431,11 @@ github.com/aliyun/alibabacloud-dkms-gcs-go-sdk v0.2.2/go.mod h1:GDtq+Kw+v0fO+j5B github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.7 h1:olLiPI2iM8Hqq6vKnSxpM3awCrm9/BeOgHpzQkOYnI4= github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.7/go.mod h1:oDg1j4kFxnhgftaiLJABkGeSvuEvSF5Lo6UmRAMruX4= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.3.10 h1:FR+drcQStOe+32sYyJYyZ7FIdgoGGBnwLl+flodp8Uo= -github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= -github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= -github.com/aws/aws-sdk-go v1.38.35/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= -github.com/aws/aws-sdk-go v1.50.8 h1:gY0WoOW+/Wz6XmYSgDH9ge3wnAevYDSQWPxxJvqAkP4= -github.com/aws/aws-sdk-go v1.50.8/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.47.5 h1:U2JlfPmrUoz5p+2X/XwKxmaJFo2oV+LbJqx8jyEvyAY= +github.com/aws/aws-sdk-go v1.47.5/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= -github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -476,8 +463,6 @@ github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= -github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -557,12 +542,9 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= -github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= @@ -573,10 +555,6 @@ github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-openapi/analysis v0.22.2 h1:ZBmNoP2h5omLKr/srIC9bfqrUGzT6g6gNv03HE9Vpj0= -github.com/go-openapi/analysis v0.22.2/go.mod h1:pDF4UbZsQTo/oNuRfAWWd4dAh4yuYf//LYorPTjrpvo= -github.com/go-openapi/errors v0.21.0 h1:FhChC/duCnfoLj1gZ0BgaBmzhJC2SL/sJr8a2vAobSY= -github.com/go-openapi/errors v0.21.0/go.mod h1:jxNTMUxRCKj65yb/okJGEtahVd7uvWnuWfj53bse4ho= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.20.3 h1:jykzYWS/kyGtsHfRt6aV8JTB9pcQAXPIA7qlZ5aRlyk= @@ -585,20 +563,10 @@ github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL9 github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= github.com/go-openapi/jsonreference v0.20.5 h1:hutI+cQI+HbSQaIGSfsBsYI0pHk+CATf8Fk5gCSj0yI= github.com/go-openapi/jsonreference v0.20.5/go.mod h1:thAqAp31UABtI+FQGKAQfmv7DbFpKNUlva2UPCxKu2Y= -github.com/go-openapi/loads v0.21.5 h1:jDzF4dSoHw6ZFADCGltDb2lE4F6De7aWSpe+IcsRzT0= -github.com/go-openapi/loads v0.21.5/go.mod h1:PxTsnFBoBe+z89riT+wYt3prmSBP6GDAQh2l9H1Flz8= -github.com/go-openapi/runtime v0.27.1 h1:ae53yaOoh+fx/X5Eaq8cRmavHgDma65XPZuvBqvJYto= -github.com/go-openapi/runtime v0.27.1/go.mod h1:fijeJEiEclyS8BRurYE1DE5TLb9/KZl6eAdbzjsrlLU= -github.com/go-openapi/spec v0.20.14 h1:7CBlRnw+mtjFGlPDRZmAMnq35cRzI91xj03HVyUi/Do= -github.com/go-openapi/spec v0.20.14/go.mod h1:8EOhTpBoFiask8rrgwbLC3zmJfz4zsCUueRuPM6GNkw= -github.com/go-openapi/strfmt v0.22.0 h1:Ew9PnEYc246TwrEspvBdDHS4BVKXy/AOVsfqGDgAcaI= -github.com/go-openapi/strfmt v0.22.0/go.mod h1:HzJ9kokGIju3/K6ap8jL+OlGAbjpSv27135Yr9OivU4= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/swag v0.22.10 h1:4y86NVn7Z2yYd6pfS4Z+Nyh3aAUL3Nul+LMbhFKy0gA= github.com/go-openapi/swag v0.22.10/go.mod h1:Cnn8BYtRlx6BNE3DPN86f/xkapGIcLWzh3CLEb4C1jI= -github.com/go-openapi/validate v0.23.0 h1:2l7PJLzCis4YUGEoW6eoQw3WhyM65WSIcjX6SQnlfDw= -github.com/go-openapi/validate v0.23.0/go.mod h1:EeiAZ5bmpSIOJV1WLfyYF9qp/B1ZgSaEpHTJHtN5cbE= github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= github.com/go-resty/resty/v2 v2.11.0 h1:i7jMfNOJYMp69lq7qozJP+bjgzfAzeOhuGlyDrqxT/8= @@ -611,8 +579,6 @@ github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg78 github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= -github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= @@ -664,7 +630,6 @@ github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 h1:0VpGH+cDhbDtdcweoyCVsF3fhN8kejK6rFe/2FFX2nU= @@ -747,33 +712,12 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1/go.mod h1:5SN9VR2LTsRFsrEC6FHg github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw= github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= -github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-sockaddr v1.0.6 h1:RSG8rKU28VTUTvEKghe5gIhIQpv8evvNpnDEyqO4u9I= -github.com/hashicorp/go-sockaddr v1.0.6/go.mod h1:uoUUmtwU7n9Dv3O4SNLeFvg0SxQ3lyjsj6+CCykpaxI= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= -github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= -github.com/hashicorp/memberlist v0.5.0 h1:EtYPN8DpAURiapus508I4n9CzHs2W+8NZGbmmR/prTM= -github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -819,7 +763,6 @@ github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2E github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -872,16 +815,9 @@ github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOj github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/microsoft/go-mssqldb v0.17.0 h1:Fto83dMZPnYv1Zwx5vHHxpNraeEaUlQ/hhHLgZiaenE= github.com/microsoft/go-mssqldb v0.17.0/go.mod h1:OkoNGhGEs8EZqchVTtochlXruEhEOaO4S0d2sB5aeGQ= -github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= -github.com/miekg/dns v1.1.41 h1:WMszZWJG0XmzbK9FEmzH2TVcqYzFesusSIB41b8KHxY= -github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= @@ -910,10 +846,6 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= -github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= -github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= @@ -944,14 +876,9 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= -github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDOCg/jA= github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= -github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml/v2 v2.0.7/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= @@ -969,11 +896,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= -github.com/prometheus/alertmanager v0.27.0 h1:V6nTa2J5V4s8TG4C4HtrBP/WNSebCCTYGGv4qecA/+I= -github.com/prometheus/alertmanager v0.27.0/go.mod h1:8Ia/R3urPmbzJ8OsdvmZvIprDwvwmYCmUbwBL+jlPOE= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= @@ -991,21 +915,14 @@ github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3d github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= -github.com/prometheus/common/sigv4 v0.1.0 h1:qoVebwtwwEhS85Czm2dSROY5fTo2PAPEVdDeppTwGX4= -github.com/prometheus/common/sigv4 v0.1.0/go.mod h1:2Jkxxk9yYvCkE5G1sQT7GuEXm57JrvHu9k5YwTjsNtI= -github.com/prometheus/exporter-toolkit v0.11.0 h1:yNTsuZ0aNCNFQ3aFTD2uhPOvr4iD7fdBvKPAEGkNf+g= -github.com/prometheus/exporter-toolkit v0.11.0/go.mod h1:BVnENhnNecpwoTLiABx7mrPB/OLRIgN74qlQbV+FK1Q= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= @@ -1029,12 +946,8 @@ github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.28.0 h1:MirSo27VyNi7RJYP3078AA1+Cyzd2GB66qy3aUHvsWY= github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 h1:bUGsEnyNbVPw06Bs80sCeARAlK8lhwqGyi6UT8ymuGk= -github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= -github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 h1:pXY9qYc/MP5zdvqWEUH6SjNiu7VhSjuVFTFiTcphaLU= -github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= +github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= +github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= @@ -1067,17 +980,10 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/urfave/cli/v2 v2.11.0/go.mod h1:f8iq5LtQ/bLxafbdBSLPPNsgaW0l/2fYYEHhAyPlwvo= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= -github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= -github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= -github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc= -github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= -github.com/xlab/treeprint v1.2.0 h1:HzHnuAF1plUN2zGlAFHbSQP2qJ0ZAD3XF5XD7OesXRQ= -github.com/xlab/treeprint v1.2.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -1116,8 +1022,6 @@ go.etcd.io/etcd/client/v3 v3.5.7/go.mod h1:sOWmj9DZUMyAngS7QQwCyAXXAL6WhgTOPLNS/ go.etcd.io/etcd/client/v3 v3.5.12 h1:v5lCPXn1pf1Uu3M4laUE2hp/geOTc5uPcYYsNe1lDxg= go.etcd.io/etcd/client/v3 v3.5.12/go.mod h1:tSbBCakoWmmddL+BKVAJHa9km+O/E+bumDe9mSbPiqw= go.mongodb.org/mongo-driver v1.11.4/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g= -go.mongodb.org/mongo-driver v1.13.1 h1:YIc7HTYsKndGK4RFzJ3covLz1byri52x0IoMB0Pt/vk= -go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -1162,8 +1066,6 @@ go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxi go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= -go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/automaxprocs v1.5.2/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8= go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= @@ -1186,7 +1088,6 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -1262,7 +1163,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1382,8 +1282,6 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1415,7 +1313,6 @@ golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1526,7 +1423,6 @@ golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=