26 lines
665 B
Go
26 lines
665 B
Go
package apis
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"gitlink.org.cn/JointCloud/pcm-participant-k8s/common"
|
|
"gitlink.org.cn/JointCloud/pcm-participant-k8s/model"
|
|
"gitlink.org.cn/JointCloud/pcm-participant-k8s/service"
|
|
"net/http"
|
|
)
|
|
|
|
func CreateContainer(ctx *gin.Context) {
|
|
var param model.CreateContainerParam
|
|
if err := ctx.BindJSON(¶m); err != nil {
|
|
model.Response(ctx, http.StatusBadRequest, common.INVALIDPARAMS, err)
|
|
return
|
|
}
|
|
client := common.GetK8sClient()
|
|
err := service.CreateContainer(client, ¶m)
|
|
if err != nil {
|
|
model.Response(ctx, 500, common.INVOKEERROR, err)
|
|
return
|
|
}
|
|
|
|
model.Response(ctx, http.StatusOK, common.SUCCESS, err)
|
|
}
|