Files
certmanager/internal/grpc/handler/service.go
Олег Бородин 1cdbd2b034 certmanager updates
2024-08-10 10:19:56 +02:00

68 lines
2.0 KiB
Go

package handler
import (
"context"
"certmanager/pkg/cmctl"
)
func (hand *Handler) CreateServicePair(ctx context.Context, params *cmctl.CreateServicePairParams) (*cmctl.CreateServicePairResult, error) {
var err error
hand.log.Debugf("Handle CreateServicePair call")
res := &cmctl.CreateServicePairResult{}
userID, err := hand.Authentificate(ctx)
if err != nil {
return res, err
}
res, err = hand.lg.CreateServicePair(ctx, userID, params)
return res, err
}
func (hand *Handler) RevokeServicePair(ctx context.Context, params *cmctl.RevokeServicePairParams) (*cmctl.RevokeServicePairResult, error) {
var err error
hand.log.Debugf("Handle RevokeServicePair call")
res := &cmctl.RevokeServicePairResult{}
userID, err := hand.Authentificate(ctx)
if err != nil {
return res, err
}
res, err = hand.lg.RevokeServicePair(ctx, userID, params)
return res, err
}
func (hand *Handler) UnrevokeServicePair(ctx context.Context, params *cmctl.UnrevokeServicePairParams) (*cmctl.UnrevokeServicePairResult, error) {
var err error
hand.log.Debugf("Handle UnrevokeServicePair call")
res := &cmctl.UnrevokeServicePairResult{}
userID, err := hand.Authentificate(ctx)
if err != nil {
return res, err
}
res, err = hand.lg.UnrevokeServicePair(ctx, userID, params)
return res, err
}
func (hand *Handler) ListServicePairs(ctx context.Context, params *cmctl.ListServicePairsParams) (*cmctl.ListServicePairsResult, error) {
var err error
hand.log.Debugf("Handle ListServicePairs call")
res := &cmctl.ListServicePairsResult{}
userID, err := hand.Authentificate(ctx)
if err != nil {
return res, err
}
res, err = hand.lg.ListServicePairs(ctx, userID, params)
return res, err
}
func (hand *Handler) GetServicePair(ctx context.Context, params *cmctl.GetServicePairParams) (*cmctl.GetServicePairResult, error) {
var err error
hand.log.Debugf("Handle GetServicePair call")
res := &cmctl.GetServicePairResult{}
userID, err := hand.Authentificate(ctx)
if err != nil {
return res, err
}
res, err = hand.lg.GetServicePair(ctx, userID, params)
return res, err
}