32 lines
614 B
Go
32 lines
614 B
Go
package handler
|
|
|
|
import (
|
|
"certmanager/pkg/cmctl"
|
|
"certmanager/pkg/auxhttp"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func (hand *Handler) GetStatus(gctx *gin.Context) {
|
|
var err error
|
|
nReq := &cmctl.GetStatusParams{}
|
|
// Bind request
|
|
err = gctx.ShouldBind(nReq)
|
|
if err != nil {
|
|
hand.log.Errorf("Cannot bind: %v", err)
|
|
auxhttp.SendError(gctx, err)
|
|
return
|
|
}
|
|
// Call logic
|
|
ctx := gctx.Request.Context()
|
|
lgRes, err := hand.lg.GetStatus(ctx, nReq)
|
|
if err != nil {
|
|
hand.log.Errorf("Got error: %v", err)
|
|
auxhttp.SendError(gctx, err)
|
|
return
|
|
}
|
|
// Send result
|
|
nRes := lgRes
|
|
auxhttp.SendResult(gctx, nRes)
|
|
}
|