openapi: GET /script-policy endpoint to list script policies

This commit is contained in:
2024-12-13 22:15:05 -08:00
parent 346f49610d
commit 00fdbd9611
16 changed files with 1004 additions and 1 deletions

View File

@@ -83,10 +83,12 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if len(elem) == 0 {
switch r.Method {
case "GET":
s.handleListScriptPolicyRequest([0]string{}, elemIsEscaped, w, r)
case "POST":
s.handleCreateScriptPolicyRequest([0]string{}, elemIsEscaped, w, r)
default:
s.notAllowed(w, r, "POST")
s.notAllowed(w, r, "GET,POST")
}
return
@@ -714,6 +716,14 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
if len(elem) == 0 {
switch method {
case "GET":
r.name = ListScriptPolicyOperation
r.summary = "Get list of script policies"
r.operationID = "listScriptPolicy"
r.pathPattern = "/script-policy"
r.args = args
r.count = 0
return r, true
case "POST":
r.name = CreateScriptPolicyOperation
r.summary = "Create a new script policy"