Files
isp-config-service/controller/route.go
T
2019-10-25 12:18:34 +03:00

38 lines
842 B
Go

package controller
import (
"github.com/integration-system/isp-lib/structure"
"isp-config-service/store"
"isp-config-service/store/state"
)
var (
Routes *routes
)
type routes struct {
rstore *store.Store
}
// GetRoutes godoc
// @Summary Метод получения маршрутов
// @Description Возвращает все доступные модули
// @Tags Роуты
// @Accept json
// @Produce json
// @Success 200 {array} structure.BackendDeclaration
// @Router /routing/get_routes [POST]
func (c *routes) GetRoutes() ([]structure.BackendDeclaration, error) {
var response structure.RoutingConfig
c.rstore.VisitReadonlyState(func(state state.ReadonlyState) {
response = state.Mesh().GetRoutes()
})
return response, nil
}
func NewRoutes(rstore *store.Store) *routes {
return &routes{
rstore: rstore,
}
}