59 lines
907 B
Go
59 lines
907 B
Go
// Copyright (C) 2023 Marius Schellenberger
|
|
|
|
package server
|
|
|
|
import (
|
|
"git.giftfish.de/ston1th/keyctl/pkg/api/types"
|
|
"git.giftfish.de/ston1th/keyctl/pkg/api/v1/schema"
|
|
"git.giftfish.de/ston1th/keyctl/pkg/core"
|
|
)
|
|
|
|
const (
|
|
healthz = "/healthz"
|
|
keyID = schema.KeyPath + core.IDRoute
|
|
keyReqID = schema.KeyPath + core.IDRoute + core.AIDRoute
|
|
reqID = schema.ReqPath + core.IDRoute
|
|
)
|
|
|
|
var Routes = []types.Route{
|
|
{
|
|
healthz,
|
|
healthzHandler,
|
|
[]string{"GET"},
|
|
},
|
|
{
|
|
schema.KeyPath,
|
|
local(keyListHandler),
|
|
[]string{"GET"},
|
|
},
|
|
{
|
|
schema.KeyPath,
|
|
local(newHandler),
|
|
[]string{"POST"},
|
|
},
|
|
{
|
|
keyID,
|
|
keyHandler,
|
|
[]string{"GET"},
|
|
},
|
|
{
|
|
keyReqID,
|
|
keyHandler,
|
|
[]string{"GET"},
|
|
},
|
|
{
|
|
keyID,
|
|
local(keyHandler),
|
|
[]string{"DELETE"},
|
|
},
|
|
{
|
|
schema.ReqPath,
|
|
local(reqListHandler),
|
|
[]string{"GET"},
|
|
},
|
|
{
|
|
reqID,
|
|
local(reqHandler),
|
|
[]string{"PUT", "DELETE"},
|
|
},
|
|
}
|