forked from Cepave/open-falcon-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
host.go
27 lines (22 loc) · 742 Bytes
/
host.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
package restful
import (
mvc "github.com/Cepave/open-falcon-backend/common/gin/mvc"
commonModel "github.com/Cepave/open-falcon-backend/common/model"
"github.com/Cepave/open-falcon-backend/modules/mysqlapi/rdb"
)
func listHosts(
paging *struct {
Page *commonModel.Paging `mvc:"pageSize[50] pageOrderBy[id#asc]"`
},
) (*commonModel.Paging, mvc.OutputBody) {
agents, resultPaging := rdb.ListHosts(*paging.Page)
return resultPaging, mvc.JsonOutputBody(agents)
}
func listHostgroups(
paging *struct {
Page *commonModel.Paging `mvc:"pageSize[50] pageOrderBy[id#asc]"`
},
) (*commonModel.Paging, mvc.OutputBody) {
hostgroups, resultPaging := rdb.ListHostgroups(*paging.Page)
return resultPaging, mvc.JsonOutputBody(hostgroups)
}