41 lines
1.0 KiB
Go
41 lines
1.0 KiB
Go
package apis
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"gitlink.org.cn/JointCloud/pcm-openi/common"
|
|
"gitlink.org.cn/JointCloud/pcm-openi/model"
|
|
"net/http"
|
|
)
|
|
|
|
func GetTaskCreationRequired(ctx *gin.Context) {
|
|
token := ctx.Query(common.ACCESSTOKEN)
|
|
reqUrl := common.OPENIPREFIX + common.TASKCREATIONREQUIRED
|
|
|
|
var resp model.TaskCreationRequired
|
|
|
|
var param model.TaskCreationRequiredParam
|
|
if err := ctx.BindJSON(¶m); err != nil {
|
|
model.Response(ctx, http.StatusBadRequest, common.INVALIDPARAMS, err)
|
|
return
|
|
}
|
|
|
|
req := common.GetRestyRequest(common.TIMEOUT)
|
|
_, err := req.
|
|
SetQueryParam(common.ACCESSTOKEN, token).
|
|
SetQueryParam("job_type", param.JobType).
|
|
SetQueryParam("compute_source", param.ComputeSource).
|
|
SetQueryParam("cluster_type", param.ClusterType).
|
|
SetPathParam("username", param.UserName).
|
|
SetPathParam("reponame", param.RepoName).
|
|
SetResult(&resp).
|
|
Get(reqUrl)
|
|
|
|
if err != nil {
|
|
model.Response(ctx, 500, common.INVOKEERROR, err)
|
|
return
|
|
}
|
|
|
|
model.Response(ctx, http.StatusOK, common.SUCCESS, resp)
|
|
|
|
}
|