31 lines
737 B
Go
31 lines
737 B
Go
package apis
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"gitlink.org.cn/JointCloud/pcm-participant-eci/common"
|
|
"gitlink.org.cn/JointCloud/pcm-participant-eci/model"
|
|
"gitlink.org.cn/JointCloud/pcm-participant-eci/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.GetEciClient()
|
|
resp, err := service.CreateContainer(client, ¶m)
|
|
if err != nil {
|
|
return
|
|
}
|
|
if !resp.IsSuccess() {
|
|
|
|
model.Response(ctx, 500, common.INVOKEERROR, resp.String())
|
|
return
|
|
|
|
}
|
|
|
|
model.Response(ctx, http.StatusOK, common.SUCCESS, resp.ContainerGroupId)
|
|
}
|