summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-28 15:00:06 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-28 15:00:06 +0100
commit5caebfb4b7c3b73988f067082b219ce5b7f409ba (patch)
tree75e533bcc855310e5f0db7d1f2e64a3967e3f0ed /lib
parent0eccaf1a33f22230ddf87051e5eef01ac045b766 (diff)
Defined structures for /exec and /signal response.
Diffstat (limited to 'lib')
-rw-r--r--lib/apiv1/exec.go23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/apiv1/exec.go b/lib/apiv1/exec.go
index f61c5b2..baf431f 100644
--- a/lib/apiv1/exec.go
+++ b/lib/apiv1/exec.go
@@ -31,6 +31,18 @@ type (
CmdTimeout int `json:"timeout"` // command completion timeout in Second
}
+ // ExecRes JSON result of /exec command
+ ExecRes struct {
+ Status string `json:"status"` // status OK
+ CmdID string `json:"cmdID"` // command unique ID
+ }
+
+ // ExecSigRes JSON result of /signal command
+ ExecSigRes struct {
+ Status string `json:"status"` // status OK
+ CmdID string `json:"cmdID"` // command unique ID
+ }
+
// ExecInMsg Message used to received input characters (stdin)
ExecInMsg struct {
CmdID string `json:"cmdID"`
@@ -374,11 +386,7 @@ func (s *APIService) execCmd(c *gin.Context) {
return
}
- c.JSON(http.StatusOK,
- gin.H{
- "status": "OK",
- "cmdID": execWS.CmdID,
- })
+ c.JSON(http.StatusOK, ExecRes{Status: "OK", CmdID: execWS.CmdID})
}
// ExecCmd executes remotely a command
@@ -404,8 +412,5 @@ func (s *APIService) execSignalCmd(c *gin.Context) {
return
}
- c.JSON(http.StatusOK,
- gin.H{
- "status": "OK",
- })
+ c.JSON(http.StatusOK, ExecSigRes{Status: "OK", CmdID: args.CmdID})
}