MCPcopy Create free account
hub / github.com/OpenSN-Library/OpenSN-Library / AddInstanceHandler

Function AddInstanceHandler

daemon/pkg/handler/instance_handler.go:16–41  ·  view source on GitHub ↗
(ctx *gin.Context)

Source from the content-addressed store, hash-verified

14)
15
16func AddInstanceHandler(ctx *gin.Context) {
17 var req ginmodel.AddInstanceRequest
18 if err := ctx.Bind(&req); err != nil {
19 jsonResp := ginmodel.JsonResp{
20 Code: -1,
21 Message: fmt.Sprintf("Invalid Request Data: %s", err.Error()),
22 }
23 ctx.JSON(http.StatusBadRequest, jsonResp)
24 return
25 }
26
27 // err := synchronizer.AddInstance(req.NodeIndex, req.Instance)
28 // if err != nil {
29 // jsonResp := ginmodel.JsonResp{
30 // Code: -1,
31 // Message: fmt.Sprintf("Add Instance Error: %s", err.Error()),
32 // }
33 // ctx.JSON(http.StatusInternalServerError, jsonResp)
34 // return
35 // }
36 jsonResp := ginmodel.JsonResp{
37 Code: 0,
38 Message: "Success",
39 }
40 ctx.JSON(http.StatusOK, jsonResp)
41}
42
43func DelInstanceHandler(ctx *gin.Context) {
44 var req ginmodel.SingleInstanceRequest

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected