mirror of
https://github.com/openziti/zrok.git
synced 2024-11-21 23:53:19 +01:00
disable elaboration (#30); enable lint
This commit is contained in:
parent
386c41f41a
commit
97878a7758
@ -23,6 +23,7 @@ func Run(cfg *Config) error {
|
||||
api.KeyAuth = ZrokAuthenticate
|
||||
api.IdentityCreateAccountHandler = identity.CreateAccountHandlerFunc(createAccountHandler)
|
||||
api.IdentityEnableHandler = newEnableHandler(cfg)
|
||||
api.IdentityDisableHandler = newDisableHandler(cfg)
|
||||
api.IdentityLoginHandler = identity.LoginHandlerFunc(loginHandler)
|
||||
api.MetadataOverviewHandler = metadata.OverviewHandlerFunc(overviewHandler)
|
||||
api.MetadataVersionHandler = metadata.VersionHandlerFunc(versionHandler)
|
||||
|
25
controller/disable.go
Normal file
25
controller/disable.go
Normal file
@ -0,0 +1,25 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
|
||||
"github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/identity"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type disableHandler struct {
|
||||
cfg *Config
|
||||
}
|
||||
|
||||
func newDisableHandler(cfg *Config) *disableHandler {
|
||||
return &disableHandler{cfg: cfg}
|
||||
}
|
||||
|
||||
func (self *disableHandler) Handle(params identity.DisableParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
_, err := str.Begin()
|
||||
if err != nil {
|
||||
logrus.Errorf("error starting transaction: %v", err)
|
||||
return identity.NewDisableInternalServerError().WithPayload(rest_model_zrok.ErrorMessage(err.Error()))
|
||||
}
|
||||
return identity.NewDisableOK()
|
||||
}
|
@ -33,7 +33,7 @@ func (self *enableHandler) Handle(params identity.EnableParams, principal *rest_
|
||||
tx, err := str.Begin()
|
||||
if err != nil {
|
||||
logrus.Errorf("error starting transaction: %v", err)
|
||||
return identity.NewCreateAccountInternalServerError().WithPayload(rest_model_zrok.ErrorMessage(err.Error()))
|
||||
return identity.NewEnableInternalServerError().WithPayload(rest_model_zrok.ErrorMessage(err.Error()))
|
||||
}
|
||||
|
||||
client, err := edgeClient(self.cfg.Ziti)
|
||||
|
Loading…
Reference in New Issue
Block a user