(ctx *gin.Context)
| 210 | } |
| 211 | |
| 212 | func StartInstanceHander(ctx *gin.Context) { |
| 213 | var req ginmodel.SingleInstanceRequest |
| 214 | if err := ctx.Bind(&req); err != nil { |
| 215 | jsonResp := ginmodel.JsonResp{ |
| 216 | Code: -1, |
| 217 | Message: fmt.Sprintf("Invalid Request Data: %s", err.Error()), |
| 218 | } |
| 219 | ctx.JSON(http.StatusBadRequest, jsonResp) |
| 220 | return |
| 221 | } |
| 222 | |
| 223 | err := synchronizer.UpdateInstanceInfo(req.NodeIndex, req.InstanceID, func(i *model.Instance) error { |
| 224 | i.Start = true |
| 225 | return nil |
| 226 | }) |
| 227 | if err != nil { |
| 228 | jsonResp := ginmodel.JsonResp{ |
| 229 | Code: -1, |
| 230 | Message: fmt.Sprintf("Start Instance Error: %s", err.Error()), |
| 231 | } |
| 232 | ctx.JSON(http.StatusInternalServerError, jsonResp) |
| 233 | return |
| 234 | } |
| 235 | jsonResp := ginmodel.JsonResp{ |
| 236 | Code: 0, |
| 237 | Message: "Success", |
| 238 | } |
| 239 | ctx.JSON(http.StatusOK, jsonResp) |
| 240 | } |
| 241 | |
| 242 | func StopInstanceHandler(ctx *gin.Context) { |
| 243 | var req ginmodel.SingleInstanceRequest |
nothing calls this directly
no outgoing calls
no test coverage detected