disable elaboration (#30); enable lint

This commit is contained in:
Michael Quigley 2022-09-02 10:50:13 -04:00
parent 386c41f41a
commit 97878a7758
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
3 changed files with 27 additions and 1 deletions

View File

@ -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
View 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()
}

View File

@ -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)