some api changes

This commit is contained in:
ston1th 2021-10-19 21:24:14 +02:00
commit 70fd3f71e5
11 changed files with 118 additions and 76 deletions

View file

@ -2,29 +2,33 @@ package server
import (
"git.giftfish.de/ston1th/haproxy-lb/pkg/api/types"
schemav1 "git.giftfish.de/ston1th/haproxy-lb/pkg/api/v1/schema"
"git.giftfish.de/ston1th/haproxy-lb/pkg/api/v1/schema"
)
const v1 = "/" + schemav1.Version
const (
healthz = "/healthz"
lbcluster = schema.LBPath + "/{cluster:[a-zA-Z0-9-]+$}"
lbclustername = schema.LBPath + "/{cluster:[a-zA-Z0-9-]+}/{name:[a-zA-Z0-9-_]+$}"
)
var Routes = []types.Route{
{
"/healthz",
healthz,
healthzHandler,
[]string{"GET"},
},
{
v1 + "/lb",
schema.LBPath,
authHandler(lbListHandler),
[]string{"GET"},
},
{
v1 + "/lb/{cluster:[a-zA-Z0-9-]+$}",
lbcluster,
authHandler(lbClusterHandler),
[]string{"GET", "DELETE"},
},
{
v1 + "/lb/{cluster:[a-zA-Z0-9-]+}/{name:[a-zA-Z0-9-_]+$}",
lbclustername,
authHandler(lbHandler),
[]string{"GET", "POST", "DELETE"},
},