Merge pull request 'Add field to create virtual machine' (#68) from qiwang/pcm-coordinator:master into master
Former-commit-id: 32e055d907cb98a1f36bc3372efe9cd6725f60c6
This commit is contained in:
commit
186741d480
|
@ -109,7 +109,6 @@ type (
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
||||||
commitVmTaskReq {
|
commitVmTaskReq {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
NsID string `json:"nsID"`
|
NsID string `json:"nsID"`
|
||||||
|
|
|
@ -38,12 +38,15 @@ type (
|
||||||
StdErrFile string `json:"stdErrFile,optional"`
|
StdErrFile string `json:"stdErrFile,optional"`
|
||||||
StdInput string `json:"stdInput,optional"`
|
StdInput string `json:"stdInput,optional"`
|
||||||
Environment map[string]string `json:"environment,optional"`
|
Environment map[string]string `json:"environment,optional"`
|
||||||
|
ClusterType string `json:"clusterType,optional"`
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
commitHpcTaskResp {
|
commitHpcTaskResp {
|
||||||
TaskId int64 `json:"taskId"`
|
TaskId int64 `json:"taskId"`
|
||||||
|
Code int32 `json:"code"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -109,15 +109,15 @@ type VmInfo struct {
|
||||||
|
|
||||||
type PushTaskInfoReq struct {
|
type PushTaskInfoReq struct {
|
||||||
AdapterId int64 `json:"adapterId"`
|
AdapterId int64 `json:"adapterId"`
|
||||||
HpcInfoList []*HpcInfo
|
HpcInfoList []*HpcInfo `json:"hpcInfoList"`
|
||||||
CloudInfoList []*CloudInfo
|
CloudInfoList []*CloudInfo `json:"cloudInfoList"`
|
||||||
AiInfoList []*AiInfo
|
AiInfoList []*AiInfo `json:"aiInfoList"`
|
||||||
VmInfoList []*VmInfo
|
VmInfoList []*VmInfo `json:"vmInfoList"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PushTaskInfoResp struct {
|
type PushTaskInfoResp struct {
|
||||||
Code int64
|
Code int64 `json:"code"`
|
||||||
Msg string
|
Msg string `json:"msg"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PushResourceInfoReq struct {
|
type PushResourceInfoReq struct {
|
||||||
|
|
|
@ -332,10 +332,12 @@ type (
|
||||||
Server {
|
Server {
|
||||||
Name string `json:"name,optional" copier:"Name"`
|
Name string `json:"name,optional" copier:"Name"`
|
||||||
FlavorRef string `json:"flavorRef,optional" copier:"FlavorRef"`
|
FlavorRef string `json:"flavorRef,optional" copier:"FlavorRef"`
|
||||||
|
Description string `json:"description,optional" copier:"Description"`
|
||||||
ImageRef string `json:"imageRef,optional" copier:"ImageRef"`
|
ImageRef string `json:"imageRef,optional" copier:"ImageRef"`
|
||||||
Networks []CreNetwork `json:"networks,optional" copier:"Networks"`
|
Networks []CreNetwork `json:"networks,optional" copier:"Networks"`
|
||||||
//AdminPass string `json:"adminPass" copier:"AdminPass"`
|
//AdminPass string `json:"adminPass" copier:"AdminPass"`
|
||||||
BlockDeviceMappingV2 []Block_device_mapping_v2 `json:"block_device_mapping_v2,optional" copier:"BlockDeviceMappingV2"`
|
BlockDeviceMappingV2 []Block_device_mapping_v2 `json:"block_device_mapping_v2,optional" copier:"BlockDeviceMappingV2"`
|
||||||
|
MinCount int32 `json:"min_count,optional" copier:"MinCount"`
|
||||||
}
|
}
|
||||||
CreNetwork {
|
CreNetwork {
|
||||||
Uuid string `json:"uuid" copier:"Uuid"`
|
Uuid string `json:"uuid" copier:"Uuid"`
|
||||||
|
@ -714,7 +716,7 @@ type (
|
||||||
Ipv6AddressScope string `json:"ipv6_address_scope,optional" copier:"Ipv6AddressScope"`
|
Ipv6AddressScope string `json:"ipv6_address_scope,optional" copier:"Ipv6AddressScope"`
|
||||||
L2Adjacency bool `json:"l2_adjacency,optional" copier:"L2Adjacency"`
|
L2Adjacency bool `json:"l2_adjacency,optional" copier:"L2Adjacency"`
|
||||||
Mtu int64 `json:"mtu,optional" copier:"Mtu"`
|
Mtu int64 `json:"mtu,optional" copier:"Mtu"`
|
||||||
Name string `json:",optional" copier:"Name"`
|
Name string `json:"name,optional" copier:"Name"`
|
||||||
PortSecurityEnabled bool `json:"port_security_enabled,optional" copier:"PortSecurityEnabled"`
|
PortSecurityEnabled bool `json:"port_security_enabled,optional" copier:"PortSecurityEnabled"`
|
||||||
ProjectId string `json:"project_id,optional" copier:"ProjectId"`
|
ProjectId string `json:"project_id,optional" copier:"ProjectId"`
|
||||||
QosPolicyId string `json:"qos_policy_id,optional" copier:"QosPolicyId"`
|
QosPolicyId string `json:"qos_policy_id,optional" copier:"QosPolicyId"`
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package adapters
|
package adapters
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func AdaptersListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func AdaptersListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.AdapterQueryReq
|
var req types.AdapterQueryReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := adapters.NewAdaptersListLogic(r.Context(), svcCtx)
|
l := adapters.NewAdaptersListLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.AdaptersList(&req)
|
resp, err := l.AdaptersList(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package adapters
|
package adapters
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func ClusterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func ClusterListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.ClusterReq
|
var req types.ClusterReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := adapters.NewClusterListLogic(r.Context(), svcCtx)
|
l := adapters.NewClusterListLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.ClusterList(&req)
|
resp, err := l.ClusterList(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package adapters
|
package adapters
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func CreateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func CreateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.AdapterCreateReq
|
var req types.AdapterCreateReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := adapters.NewCreateAdapterLogic(r.Context(), svcCtx)
|
l := adapters.NewCreateAdapterLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.CreateAdapter(&req)
|
resp, err := l.CreateAdapter(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package adapters
|
package adapters
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func CreateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func CreateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.ClusterCreateReq
|
var req types.ClusterCreateReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := adapters.NewCreateClusterLogic(r.Context(), svcCtx)
|
l := adapters.NewCreateClusterLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.CreateCluster(&req)
|
resp, err := l.CreateCluster(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package adapters
|
package adapters
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func DeleteAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func DeleteAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.AdapterDelReq
|
var req types.AdapterDelReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := adapters.NewDeleteAdapterLogic(r.Context(), svcCtx)
|
l := adapters.NewDeleteAdapterLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.DeleteAdapter(&req)
|
resp, err := l.DeleteAdapter(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package adapters
|
package adapters
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func DeleteClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func DeleteClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.FId
|
var req types.FId
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := adapters.NewDeleteClusterLogic(r.Context(), svcCtx)
|
l := adapters.NewDeleteClusterLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.DeleteCluster(&req)
|
resp, err := l.DeleteCluster(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package adapters
|
package adapters
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func GetAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.AdapterDelReq
|
var req types.AdapterDelReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := adapters.NewGetAdapterLogic(r.Context(), svcCtx)
|
l := adapters.NewGetAdapterLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.GetAdapter(&req)
|
resp, err := l.GetAdapter(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package adapters
|
package adapters
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetAdapterRelationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func GetAdapterRelationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.AdapterRelationQueryReq
|
var req types.AdapterRelationQueryReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := adapters.NewGetAdapterRelationLogic(r.Context(), svcCtx)
|
l := adapters.NewGetAdapterRelationLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.GetAdapterRelation(&req)
|
resp, err := l.GetAdapterRelation(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package adapters
|
package adapters
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func GetClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.FId
|
var req types.FId
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := adapters.NewGetClusterLogic(r.Context(), svcCtx)
|
l := adapters.NewGetClusterLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.GetCluster(&req)
|
resp, err := l.GetCluster(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package adapters
|
package adapters
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetClusterSumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func GetClusterSumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.ClusterSumReq
|
var req types.ClusterSumReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := adapters.NewGetClusterSumLogic(r.Context(), svcCtx)
|
l := adapters.NewGetClusterSumLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.GetClusterSum(&req)
|
resp, err := l.GetClusterSum(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package adapters
|
package adapters
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func UpdateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func UpdateAdapterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.AdapterReq
|
var req types.AdapterReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := adapters.NewUpdateAdapterLogic(r.Context(), svcCtx)
|
l := adapters.NewUpdateAdapterLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.UpdateAdapter(&req)
|
resp, err := l.UpdateAdapter(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package adapters
|
package adapters
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/adapters"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func UpdateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func UpdateClusterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.ClusterCreateReq
|
var req types.ClusterCreateReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := adapters.NewUpdateClusterLogic(r.Context(), svcCtx)
|
l := adapters.NewUpdateClusterLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.UpdateCluster(&req)
|
resp, err := l.UpdateCluster(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
)
|
)
|
||||||
|
@ -12,6 +12,10 @@ func CenterResourcesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
l := core.NewCenterResourcesLogic(r.Context(), svcCtx)
|
l := core.NewCenterResourcesLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.CenterResources()
|
resp, err := l.CenterResources()
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
@ -20,6 +19,10 @@ func CommitTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
|
||||||
l := core.NewCommitTaskLogic(r.Context(), svcCtx)
|
l := core.NewCommitTaskLogic(r.Context(), svcCtx)
|
||||||
err := l.CommitTask(&req)
|
err := l.CommitTask(&req)
|
||||||
result.HttpResult(r, w, nil, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func CommitVmTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func CommitVmTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.CommitVmTaskReq
|
var req types.CommitVmTaskReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := core.NewCommitVmTaskLogic(r.Context(), svcCtx)
|
l := core.NewCommitVmTaskLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.CommitVmTask(&req)
|
resp, err := l.CommitVmTask(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,6 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) [2023] [pcm]
|
|
||||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
|
||||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
||||||
You may obtain a copy of Mulan PSL v2 at:
|
|
||||||
http://license.coscl.org.cn/MulanPSL2
|
|
||||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
||||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
||||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
||||||
See the Mulan PSL v2 for more details.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
@ -34,6 +19,10 @@ func DeleteTaskHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
|
||||||
l := core.NewDeleteTaskLogic(r.Context(), svcCtx)
|
l := core.NewDeleteTaskLogic(r.Context(), svcCtx)
|
||||||
err := l.DeleteTask(&req)
|
err := l.DeleteTask(&req)
|
||||||
result.HttpResult(r, w, nil, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,3 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) [2023] [pcm]
|
|
||||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
|
||||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
||||||
You may obtain a copy of Mulan PSL v2 at:
|
|
||||||
http://license.coscl.org.cn/MulanPSL2
|
|
||||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
||||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
||||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
||||||
See the Mulan PSL v2 for more details.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,17 +1,3 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) [2023] [pcm]
|
|
||||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
|
||||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
||||||
You may obtain a copy of Mulan PSL v2 at:
|
|
||||||
http://license.coscl.org.cn/MulanPSL2
|
|
||||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
||||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
||||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
||||||
See the Mulan PSL v2 for more details.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,17 +1,3 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) [2023] [pcm]
|
|
||||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
|
||||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
||||||
You may obtain a copy of Mulan PSL v2 at:
|
|
||||||
http://license.coscl.org.cn/MulanPSL2
|
|
||||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
||||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
||||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
||||||
See the Mulan PSL v2 for more details.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,17 +1,3 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) [2023] [pcm]
|
|
||||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
|
||||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
||||||
You may obtain a copy of Mulan PSL v2 at:
|
|
||||||
http://license.coscl.org.cn/MulanPSL2
|
|
||||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
||||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
||||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
||||||
See the Mulan PSL v2 for more details.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,24 +1,9 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) [2023] [pcm]
|
|
||||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
|
||||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
||||||
You may obtain a copy of Mulan PSL v2 at:
|
|
||||||
http://license.coscl.org.cn/MulanPSL2
|
|
||||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
||||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
||||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
||||||
See the Mulan PSL v2 for more details.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"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/logic/core"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
)
|
)
|
||||||
|
@ -27,6 +12,10 @@ func GetResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
l := core.NewGetResourcePanelConfigLogic(r.Context(), svcCtx)
|
l := core.NewGetResourcePanelConfigLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.GetResourcePanelConfig()
|
resp, err := l.GetResourcePanelConfig()
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,9 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) [2023] [pcm]
|
|
||||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
|
||||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
||||||
You may obtain a copy of Mulan PSL v2 at:
|
|
||||||
http://license.coscl.org.cn/MulanPSL2
|
|
||||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
||||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
||||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
||||||
See the Mulan PSL v2 for more details.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
)
|
)
|
||||||
|
@ -26,6 +12,10 @@ func JobTotalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
l := core.NewJobTotalLogic(r.Context(), svcCtx)
|
l := core.NewJobTotalLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.JobTotal()
|
resp, err := l.JobTotal()
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,3 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) [2023] [pcm]
|
|
||||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
|
||||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
||||||
You may obtain a copy of Mulan PSL v2 at:
|
|
||||||
http://license.coscl.org.cn/MulanPSL2
|
|
||||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
||||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
||||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
||||||
See the Mulan PSL v2 for more details.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,17 +1,3 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) [2023] [pcm]
|
|
||||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
|
||||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
||||||
You may obtain a copy of Mulan PSL v2 at:
|
|
||||||
http://license.coscl.org.cn/MulanPSL2
|
|
||||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
||||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
||||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
||||||
See the Mulan PSL v2 for more details.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,24 +1,9 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) [2023] [pcm]
|
|
||||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
|
||||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
||||||
You may obtain a copy of Mulan PSL v2 at:
|
|
||||||
http://license.coscl.org.cn/MulanPSL2
|
|
||||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
||||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
||||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
||||||
See the Mulan PSL v2 for more details.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"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/logic/core"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
)
|
)
|
||||||
|
@ -27,6 +12,10 @@ func ListDomainResourceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
l := core.NewListDomainResourceLogic(r.Context(), svcCtx)
|
l := core.NewListDomainResourceLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.ListDomainResource()
|
resp, err := l.ListDomainResource()
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,3 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) [2023] [pcm]
|
|
||||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
|
||||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
||||||
You may obtain a copy of Mulan PSL v2 at:
|
|
||||||
http://license.coscl.org.cn/MulanPSL2
|
|
||||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
||||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
||||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
||||||
See the Mulan PSL v2 for more details.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,12 +1,21 @@
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
||||||
"net/http"
|
"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/svc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func MetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func MetricsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return promhttp.Handler().ServeHTTP
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
l := core.NewMetricsLogic(r.Context(), svcCtx)
|
||||||
|
err := l.Metrics()
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,9 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) [2023] [pcm]
|
|
||||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
|
||||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
||||||
You may obtain a copy of Mulan PSL v2 at:
|
|
||||||
http://license.coscl.org.cn/MulanPSL2
|
|
||||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
||||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
||||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
||||||
See the Mulan PSL v2 for more details.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
)
|
)
|
||||||
|
@ -26,6 +12,10 @@ func NodeAssetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
l := core.NewNodeAssetsLogic(r.Context(), svcCtx)
|
l := core.NewNodeAssetsLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.NodeAssets()
|
resp, err := l.NodeAssets()
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,9 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) [2023] [pcm]
|
|
||||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
|
||||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
||||||
You may obtain a copy of Mulan PSL v2 at:
|
|
||||||
http://license.coscl.org.cn/MulanPSL2
|
|
||||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
||||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
||||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
||||||
See the Mulan PSL v2 for more details.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
)
|
)
|
||||||
|
@ -26,6 +12,10 @@ func ParticipantListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
l := core.NewParticipantListLogic(r.Context(), svcCtx)
|
l := core.NewParticipantListLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.ParticipantList()
|
resp, err := l.ParticipantList()
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ func PullTaskInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
l := core.NewPullTaskInfoLogic(r.Context(), svcCtx)
|
l := core.NewPullTaskInfoLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.PullTaskInfo(&req)
|
resp, err := l.PullTaskInfo((*clientCore.PullTaskInfoReq)(&req))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
httpx.ErrorCtx(r.Context(), w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,24 +1,8 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) [2023] [pcm]
|
|
||||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
|
||||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
||||||
You may obtain a copy of Mulan PSL v2 at:
|
|
||||||
http://license.coscl.org.cn/MulanPSL2
|
|
||||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
||||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
||||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
||||||
See the Mulan PSL v2 for more details.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/core"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
|
@ -29,12 +13,16 @@ func PutResourcePanelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.ResourcePanelConfigReq
|
var req types.ResourcePanelConfigReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := core.NewPutResourcePanelConfigLogic(r.Context(), svcCtx)
|
l := core.NewPutResourcePanelConfigLogic(r.Context(), svcCtx)
|
||||||
err := l.PutResourcePanelConfig(&req)
|
err := l.PutResourcePanelConfig(&req)
|
||||||
result.HttpResult(r, w, nil, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,3 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) [2023] [pcm]
|
|
||||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
|
||||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
||||||
You may obtain a copy of Mulan PSL v2 at:
|
|
||||||
http://license.coscl.org.cn/MulanPSL2
|
|
||||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
||||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
||||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
||||||
See the Mulan PSL v2 for more details.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
@ -20,6 +19,10 @@ func SyncClusterLoadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
|
||||||
l := core.NewSyncClusterLoadLogic(r.Context(), svcCtx)
|
l := core.NewSyncClusterLoadLogic(r.Context(), svcCtx)
|
||||||
err := l.SyncClusterLoad(&req)
|
err := l.SyncClusterLoad(&req)
|
||||||
result.HttpResult(r, w, nil, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,6 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) [2023] [pcm]
|
|
||||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
|
||||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
||||||
You may obtain a copy of Mulan PSL v2 at:
|
|
||||||
http://license.coscl.org.cn/MulanPSL2
|
|
||||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
||||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
||||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
||||||
See the Mulan PSL v2 for more details.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
@ -34,6 +19,10 @@ func TaskDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
|
||||||
l := core.NewTaskDetailLogic(r.Context(), svcCtx)
|
l := core.NewTaskDetailLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.TaskDetail(&req)
|
resp, err := l.TaskDetail(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,3 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) [2023] [pcm]
|
|
||||||
[pcm-coordinator] is licensed under Mulan PSL v2.
|
|
||||||
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
||||||
You may obtain a copy of Mulan PSL v2 at:
|
|
||||||
http://license.coscl.org.cn/MulanPSL2
|
|
||||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
||||||
EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
||||||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
||||||
See the Mulan PSL v2 for more details.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package dictionary
|
package dictionary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func AddDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func AddDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.DictEditReq
|
var req types.DictEditReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := dictionary.NewAddDictLogic(r.Context(), svcCtx)
|
l := dictionary.NewAddDictLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.AddDict(&req)
|
resp, err := l.AddDict(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package dictionary
|
package dictionary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func AddDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func AddDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.DictItemEditReq
|
var req types.DictItemEditReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := dictionary.NewAddDictItemLogic(r.Context(), svcCtx)
|
l := dictionary.NewAddDictItemLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.AddDictItem(&req)
|
resp, err := l.AddDictItem(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package dictionary
|
package dictionary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func DeleteDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func DeleteDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.CId
|
var req types.CId
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := dictionary.NewDeleteDictLogic(r.Context(), svcCtx)
|
l := dictionary.NewDeleteDictLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.DeleteDict(&req)
|
resp, err := l.DeleteDict(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package dictionary
|
package dictionary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func DeleteDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func DeleteDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.CId
|
var req types.CId
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := dictionary.NewDeleteDictItemLogic(r.Context(), svcCtx)
|
l := dictionary.NewDeleteDictItemLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.DeleteDictItem(&req)
|
resp, err := l.DeleteDictItem(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package dictionary
|
package dictionary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func EditDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func EditDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.DictEditReq
|
var req types.DictEditReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := dictionary.NewEditDictLogic(r.Context(), svcCtx)
|
l := dictionary.NewEditDictLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.EditDict(&req)
|
resp, err := l.EditDict(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package dictionary
|
package dictionary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func EditDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func EditDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.DictItemEditReq
|
var req types.DictItemEditReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := dictionary.NewEditDictItemLogic(r.Context(), svcCtx)
|
l := dictionary.NewEditDictItemLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.EditDictItem(&req)
|
resp, err := l.EditDictItem(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package dictionary
|
package dictionary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func GetDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.CId
|
var req types.CId
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := dictionary.NewGetDictLogic(r.Context(), svcCtx)
|
l := dictionary.NewGetDictLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.GetDict(&req)
|
resp, err := l.GetDict(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package dictionary
|
package dictionary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func GetDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.CId
|
var req types.CId
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := dictionary.NewGetDictItemLogic(r.Context(), svcCtx)
|
l := dictionary.NewGetDictItemLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.GetDictItem(&req)
|
resp, err := l.GetDictItem(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package dictionary
|
package dictionary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func ListDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func ListDictHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.DictReq
|
var req types.DictReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := dictionary.NewListDictLogic(r.Context(), svcCtx)
|
l := dictionary.NewListDictLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.ListDict(&req)
|
resp, err := l.ListDict(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package dictionary
|
package dictionary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func ListDictItemByCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func ListDictItemByCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.DictCodeReq
|
var req types.DictCodeReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := dictionary.NewListDictItemByCodeLogic(r.Context(), svcCtx)
|
l := dictionary.NewListDictItemByCodeLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.ListDictItemByCode(&req)
|
resp, err := l.ListDictItemByCode(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
package dictionary
|
package dictionary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/rest/httpx"
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/logic/dictionary"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/svc"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
"gitlink.org.cn/JointCloud/pcm-coordinator/api/internal/types"
|
||||||
"gitlink.org.cn/JointCloud/pcm-coordinator/pkg/repository/result"
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func ListDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func ListDictItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
var req types.DictItemReq
|
var req types.DictItemReq
|
||||||
if err := httpx.Parse(r, &req); err != nil {
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
result.ParamErrorResult(r, w, err)
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l := dictionary.NewListDictItemLogic(r.Context(), svcCtx)
|
l := dictionary.NewListDictItemLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.ListDictItem(&req)
|
resp, err := l.ListDictItem(&req)
|
||||||
result.HttpResult(r, w, resp, err)
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -855,7 +855,6 @@ type CommitHpcTaskReq struct {
|
||||||
TenantId int64 `json:"tenantId,optional"`
|
TenantId int64 `json:"tenantId,optional"`
|
||||||
TaskId int64 `json:"taskId,optional"`
|
TaskId int64 `json:"taskId,optional"`
|
||||||
AdapterId int64 `json:"adapterId,optional"`
|
AdapterId int64 `json:"adapterId,optional"`
|
||||||
ClusterType string `json:"clusterType,optional"`
|
|
||||||
MatchLabels map[string]string `json:"matchLabels,optional"`
|
MatchLabels map[string]string `json:"matchLabels,optional"`
|
||||||
CardCount int64 `json:"cardCount,optional"`
|
CardCount int64 `json:"cardCount,optional"`
|
||||||
WorkDir string `json:"workDir,optional"` //paratera:workingDir
|
WorkDir string `json:"workDir,optional"` //paratera:workingDir
|
||||||
|
@ -870,12 +869,13 @@ type CommitHpcTaskReq struct {
|
||||||
StdErrFile string `json:"stdErrFile,optional"`
|
StdErrFile string `json:"stdErrFile,optional"`
|
||||||
StdInput string `json:"stdInput,optional"`
|
StdInput string `json:"stdInput,optional"`
|
||||||
Environment map[string]string `json:"environment,optional"`
|
Environment map[string]string `json:"environment,optional"`
|
||||||
|
ClusterType string `json:"clusterType,optional"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CommitHpcTaskResp struct {
|
type CommitHpcTaskResp struct {
|
||||||
|
TaskId int64 `json:"taskId"`
|
||||||
Code int32 `json:"code"`
|
Code int32 `json:"code"`
|
||||||
Msg string `json:"msg"`
|
Msg string `json:"msg"`
|
||||||
TaskId int64 `json:"taskId"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ListJobReq struct {
|
type ListJobReq struct {
|
||||||
|
@ -2884,9 +2884,11 @@ type CreateServerResp struct {
|
||||||
type Server struct {
|
type Server struct {
|
||||||
Name string `json:"name,optional" copier:"Name"`
|
Name string `json:"name,optional" copier:"Name"`
|
||||||
FlavorRef string `json:"flavorRef,optional" copier:"FlavorRef"`
|
FlavorRef string `json:"flavorRef,optional" copier:"FlavorRef"`
|
||||||
|
Description string `json:"description,optional" copier:"Description"`
|
||||||
ImageRef string `json:"imageRef,optional" copier:"ImageRef"`
|
ImageRef string `json:"imageRef,optional" copier:"ImageRef"`
|
||||||
Networks []CreNetwork `json:"networks,optional" copier:"Networks"`
|
Networks []CreNetwork `json:"networks,optional" copier:"Networks"`
|
||||||
BlockDeviceMappingV2 []Block_device_mapping_v2 `json:"block_device_mapping_v2,optional" copier:"BlockDeviceMappingV2"`
|
BlockDeviceMappingV2 []Block_device_mapping_v2 `json:"block_device_mapping_v2,optional" copier:"BlockDeviceMappingV2"`
|
||||||
|
MinCount int32 `json:"min_count,optional" copier:"MinCount"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreNetwork struct {
|
type CreNetwork struct {
|
||||||
|
@ -3255,7 +3257,7 @@ type Network struct {
|
||||||
Ipv6AddressScope string `json:"ipv6_address_scope,optional" copier:"Ipv6AddressScope"`
|
Ipv6AddressScope string `json:"ipv6_address_scope,optional" copier:"Ipv6AddressScope"`
|
||||||
L2Adjacency bool `json:"l2_adjacency,optional" copier:"L2Adjacency"`
|
L2Adjacency bool `json:"l2_adjacency,optional" copier:"L2Adjacency"`
|
||||||
Mtu int64 `json:"mtu,optional" copier:"Mtu"`
|
Mtu int64 `json:"mtu,optional" copier:"Mtu"`
|
||||||
Name string `json:",optional" copier:"Name"`
|
Name string `json:"name,optional" copier:"Name"`
|
||||||
PortSecurityEnabled bool `json:"port_security_enabled,optional" copier:"PortSecurityEnabled"`
|
PortSecurityEnabled bool `json:"port_security_enabled,optional" copier:"PortSecurityEnabled"`
|
||||||
ProjectId string `json:"project_id,optional" copier:"ProjectId"`
|
ProjectId string `json:"project_id,optional" copier:"ProjectId"`
|
||||||
QosPolicyId string `json:"qos_policy_id,optional" copier:"QosPolicyId"`
|
QosPolicyId string `json:"qos_policy_id,optional" copier:"QosPolicyId"`
|
||||||
|
@ -5171,3 +5173,119 @@ type AiDatasetsResp struct {
|
||||||
type AiStrategyResp struct {
|
type AiStrategyResp struct {
|
||||||
Strategies []string `json:"strategies"`
|
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"`
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue