-
Notifications
You must be signed in to change notification settings - Fork 16
/
miscellaneous_handle.go
50 lines (40 loc) · 994 Bytes
/
miscellaneous_handle.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"net/http"
"github.com/wise2c-devops/pagoda/database"
"github.com/wise2c-devops/pagoda/playbook"
"github.com/wise2c-devops/pagoda/runtime"
"github.com/gin-gonic/gin"
)
func retrieveLogs(c *gin.Context) {
clusterID := c.Param("cluster_id")
logs, err := database.Instance().RetrieveLogs(clusterID)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"error": err.Error(),
})
} else {
c.JSON(http.StatusOK, logs)
}
}
func retrieveClusterStatus(c *gin.Context) {
clusterID := c.Param("cluster_id")
status, err := runtime.RetrieveStatus(clusterID)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"error": err.Error(),
})
return
}
c.IndentedJSON(http.StatusOK, status)
}
func components(c *gin.Context) {
ret, err := playbook.GetOrderedComponents(*workDir)
if err != nil {
c.IndentedJSON(http.StatusInternalServerError, gin.H{
"error": err.Error(),
})
return
}
c.IndentedJSON(http.StatusOK, ret)
}