add snapshots list api
This commit is contained in:
18
api.go
18
api.go
@@ -50,6 +50,24 @@ func ApiSnapshotDel(c *gin.Context) {
|
||||
}
|
||||
|
||||
func ApiSnapshotList(c *gin.Context) {
|
||||
if app, ok := cfg.apps[c.Param("app")]; ok {
|
||||
if snapshots, err := app.Snapshots(); err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{
|
||||
"message": "error",
|
||||
"error": err,
|
||||
})
|
||||
} else {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"message": "done",
|
||||
"snapshots": snapshots,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{
|
||||
"message": "error",
|
||||
"error": "no app found",
|
||||
})
|
||||
}
|
||||
c.JSON(http.StatusInternalServerError, gin.H{
|
||||
"message": "error",
|
||||
"error": "not implemented",
|
||||
|
||||
Reference in New Issue
Block a user