mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-25 17:42:25 +01:00
Add swagger docs
This commit is contained in:
@@ -8,6 +8,14 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// @Summary Get nodes
|
||||
// @Description Get nodes
|
||||
// @Tags node
|
||||
// @Produce json
|
||||
// @Param Authorization header string true "With the bearer started"
|
||||
// @Success 200 json string Response
|
||||
// @Failure 400 json string Response
|
||||
// @Router /nodes [get]
|
||||
func GetNodeList(c *gin.Context) {
|
||||
nodes, err := model.GetNodeList(nil)
|
||||
if err != nil {
|
||||
@@ -26,6 +34,15 @@ func GetNodeList(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// @Summary Get node
|
||||
// @Description Get node
|
||||
// @Tags node
|
||||
// @Produce json
|
||||
// @Param Authorization header string true "With the bearer started"
|
||||
// @Param id path string true "id"
|
||||
// @Success 200 json string Response
|
||||
// @Failure 400 json string Response
|
||||
// @Router /nodes/{id} [get]
|
||||
func GetNode(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
|
||||
@@ -54,6 +71,17 @@ func Ping(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// @Summary Post node
|
||||
// @Description Post node
|
||||
// @Tags node
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param Authorization header string true "With the bearer started"
|
||||
// @Param id path string true "post node"
|
||||
// @Success 200 json string Response
|
||||
// @Failure 500 json string Response
|
||||
// @Router /nodes/{id} [post]
|
||||
func PostNode(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
|
||||
@@ -81,6 +109,15 @@ func PostNode(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// @Summary Get tasks on node
|
||||
// @Description Get tasks on node
|
||||
// @Tags node
|
||||
// @Produce json
|
||||
// @Param Authorization header string true "With the bearer started"
|
||||
// @Param id path string true "node id"
|
||||
// @Success 200 json string Response
|
||||
// @Failure 400 json string Response
|
||||
// @Router /nodes/{id}/tasks [get]
|
||||
func GetNodeTaskList(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
|
||||
@@ -97,6 +134,15 @@ func GetNodeTaskList(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// @Summary Get system info
|
||||
// @Description Get system info
|
||||
// @Tags node
|
||||
// @Produce json
|
||||
// @Param Authorization header string true "With the bearer started"
|
||||
// @Param id path string true "node id"
|
||||
// @Success 200 json string Response
|
||||
// @Failure 400 json string Response
|
||||
// @Router /nodes/{id}/system [get]
|
||||
func GetSystemInfo(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
|
||||
@@ -109,6 +155,15 @@ func GetSystemInfo(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// @Summary Delete node
|
||||
// @Description Delete node
|
||||
// @Tags node
|
||||
// @Produce json
|
||||
// @Param Authorization header string true "With the bearer started"
|
||||
// @Param id path string true "node id"
|
||||
// @Success 200 json string Response
|
||||
// @Failure 400 json string Response
|
||||
// @Router /nodes/{id} [delete]
|
||||
func DeleteNode(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
node, err := model.GetNode(bson.ObjectIdHex(id))
|
||||
|
||||
Reference in New Issue
Block a user