Files
certmanager/internal/wrpc/handler/status.go
Олег Бородин e9d4d1ef07 import sources
2024-07-30 09:49:53 +02:00

32 lines
640 B
Go

package handler
import (
"certmanager/api/certmanagercontrol"
"certmanager/pkg/auxhttp"
"github.com/gin-gonic/gin"
)
func (hand *Handler) GetStatus(gctx *gin.Context) {
var err error
nReq := &certmanagercontrol.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)
}