@@ -23,10 +23,10 @@ func NewJobsHandlers(cmder *commander.Commander, svc *service.ScriptService) Job
|
||||
}
|
||||
|
||||
type AddJobIn struct {
|
||||
Command string `json:"command" binding:"required"`
|
||||
Command string `json:"command" binding:"required"`
|
||||
InterpreterID int64 `json:"interpreter_id"`
|
||||
Stdin *string `json:"stdin"`
|
||||
AgentID string `json:"agent_id" binding:"required"`
|
||||
AgentID string `json:"agent_id" binding:"required"`
|
||||
}
|
||||
type AddJobOut struct {
|
||||
ID int64 `json:"id"`
|
||||
@@ -45,6 +45,7 @@ type AddJobOut struct {
|
||||
// @Produce json
|
||||
// @Param body body AddJobIn true "Job request"
|
||||
// @Success 201 {object} AddJobOut
|
||||
// @Security Bearer
|
||||
// @Router /jobs [post]
|
||||
func (self *JobsHandlers) AddJob(c *gin.Context) {
|
||||
err := func() error {
|
||||
@@ -63,7 +64,11 @@ func (self *JobsHandlers) AddJob(c *gin.Context) {
|
||||
command = []string{"sh", "-c", in.Command}
|
||||
} else {
|
||||
var err error
|
||||
command, err = self.svc.ResolveCommand(c.Request.Context(), in.InterpreterID, in.Command)
|
||||
command, err = self.svc.ResolveCommand(
|
||||
c.Request.Context(),
|
||||
in.InterpreterID,
|
||||
in.Command,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user