Merge pull request 'Add virtual machine interfaces' (#71) from qiwang/pcm-coordinator:master into master
Former-commit-id: c3e65f881cf3a72fff542f781f75c1039855f18e
This commit is contained in:
commit
50d8cfe9db
|
@ -42,6 +42,10 @@ service pcm {
|
|||
@handler commitVmTaskHandler
|
||||
post /core/commitVmTask (commitVmTaskReq) returns (commitVmTaskResp)
|
||||
|
||||
@doc "提交虚拟机任务临时"
|
||||
@handler commitVmTaskTempHandler
|
||||
post /core/commitVmTaskTemp (commitVmTaskReq) returns (commitVmTaskResp)
|
||||
|
||||
@doc "删除任务"
|
||||
@handler deleteTaskHandler
|
||||
delete /core/deleteTask/:id (deleteTaskReq)
|
||||
|
|
|
@ -321,7 +321,7 @@ type (
|
|||
type (
|
||||
CreateServerReq {
|
||||
Server Server `json:"server" copier:"Server"`
|
||||
Platform string `form:"platform,optional"`
|
||||
Platform string `json:"platform,optional"`
|
||||
}
|
||||
CreateServerResp {
|
||||
Server ServerResp `json:"server" copier:"Server"`
|
||||
|
@ -748,7 +748,7 @@ type (
|
|||
type (
|
||||
CreateNetworkReq {
|
||||
Network CreateNetwork `json:"network" copier:"Network"`
|
||||
Platform string `form:"platform,optional"`
|
||||
Platform string `json:"platform,optional"`
|
||||
}
|
||||
CreateNetworkResp {
|
||||
Network Network `json:"network" copier:"Network"`
|
||||
|
@ -766,7 +766,7 @@ type (
|
|||
type (
|
||||
CreateSubnetReq {
|
||||
Subnet Subnet `json:"subnet" copier:"Subnet"`
|
||||
Platform string `form:"platform,optional"`
|
||||
Platform string `json:"platform,optional"`
|
||||
}
|
||||
CreateSubnetResp {
|
||||
Subnet SubnetResp `json:"subnet" copier:"Subnet"`
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -2871,7 +2871,7 @@ type DeleteServerResp struct {
|
|||
|
||||
type CreateServerReq struct {
|
||||
Server Server `json:"server" copier:"Server"`
|
||||
Platform string `form:"platform,optional"`
|
||||
Platform string `json:"platform,optional"`
|
||||
}
|
||||
|
||||
type CreateServerResp struct {
|
||||
|
@ -3288,7 +3288,7 @@ type DeleteNetworkResp struct {
|
|||
|
||||
type CreateNetworkReq struct {
|
||||
Network CreateNetwork `json:"network" copier:"Network"`
|
||||
Platform string `form:"platform,optional"`
|
||||
Platform string `json:"platform,optional"`
|
||||
}
|
||||
|
||||
type CreateNetworkResp struct {
|
||||
|
@ -3306,7 +3306,7 @@ type CreateNetwork struct {
|
|||
|
||||
type CreateSubnetReq struct {
|
||||
Subnet Subnet `json:"subnet" copier:"Subnet"`
|
||||
Platform string `form:"platform,optional"`
|
||||
Platform string `json:"platform,optional"`
|
||||
}
|
||||
|
||||
type CreateSubnetResp struct {
|
||||
|
|
1
go.mod
1
go.mod
|
@ -86,6 +86,7 @@ require (
|
|||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
|
|
1
go.sum
1
go.sum
|
@ -815,6 +815,7 @@ github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOj
|
|||
github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
|
||||
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k=
|
||||
github.com/microsoft/go-mssqldb v0.17.0 h1:Fto83dMZPnYv1Zwx5vHHxpNraeEaUlQ/hhHLgZiaenE=
|
||||
github.com/microsoft/go-mssqldb v0.17.0/go.mod h1:OkoNGhGEs8EZqchVTtochlXruEhEOaO4S0d2sB5aeGQ=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
|
|
Loading…
Reference in New Issue