added auth method

This commit is contained in:
ston1th 2021-02-10 23:54:31 +01:00
commit a735b9cc5e
8 changed files with 270 additions and 12 deletions

View file

@ -2,10 +2,10 @@ package server
import (
"git.giftfish.de/ston1th/haproxy-lb/pkg/api"
"git.giftfish.de/ston1th/haproxy-lb/pkg/api/v1/schema"
schemav1 "git.giftfish.de/ston1th/haproxy-lb/pkg/api/v1/schema"
)
const version = "/" + schema.Version
const v1 = "/" + schemav1.Version
var routes = []api.Route{
{
@ -14,8 +14,13 @@ var routes = []api.Route{
[]string{"GET"},
},
{
version + "/alloc",
authHandler(allocHandler),
[]string{"POST"},
v1 + "/lb",
authHandler(lbListHandler),
[]string{"GET"},
},
{
v1 + "/lb/{cluster:[a-zA-Z0-9-]+}/{name:[a-zA-Z0-9-]+$}",
authHandler(lbHandler),
[]string{"GET", "POST", "DELETE"},
},
}