Files
certmanager/internal/wrpc/handler/status.go
Олег Бородин 07b32e881e istore: updated
2024-08-07 09:20:36 +02:00

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