admin/createFrontend api roughed in (#129)

This commit is contained in:
Michael Quigley
2022-12-01 15:13:43 -05:00
parent 9db6aa1c07
commit 81e5f7e469
15 changed files with 1111 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ import (
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
"github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/account"
"github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/admin"
"github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/environment"
"github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/metadata"
"github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/service"
@@ -51,6 +52,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
ServiceAccessHandler: service.AccessHandlerFunc(func(params service.AccessParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation service.Access has not yet been implemented")
}),
AdminCreateFrontendHandler: admin.CreateFrontendHandlerFunc(func(params admin.CreateFrontendParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation admin.CreateFrontend has not yet been implemented")
}),
EnvironmentDisableHandler: environment.DisableHandlerFunc(func(params environment.DisableParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation environment.Disable has not yet been implemented")
}),
@@ -139,6 +143,8 @@ type ZrokAPI struct {
// ServiceAccessHandler sets the operation handler for the access operation
ServiceAccessHandler service.AccessHandler
// AdminCreateFrontendHandler sets the operation handler for the create frontend operation
AdminCreateFrontendHandler admin.CreateFrontendHandler
// EnvironmentDisableHandler sets the operation handler for the disable operation
EnvironmentDisableHandler environment.DisableHandler
// EnvironmentEnableHandler sets the operation handler for the enable operation
@@ -247,6 +253,9 @@ func (o *ZrokAPI) Validate() error {
if o.ServiceAccessHandler == nil {
unregistered = append(unregistered, "service.AccessHandler")
}
if o.AdminCreateFrontendHandler == nil {
unregistered = append(unregistered, "admin.CreateFrontendHandler")
}
if o.EnvironmentDisableHandler == nil {
unregistered = append(unregistered, "environment.DisableHandler")
}
@@ -389,6 +398,10 @@ func (o *ZrokAPI) initHandlerCache() {
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/frontend"] = admin.NewCreateFrontend(o.context, o.AdminCreateFrontendHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/disable"] = environment.NewDisable(o.context, o.EnvironmentDisableHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)