Files
certmanager/internal/grpc/handler/service.go
Олег Бородин 0bafb086bc certmanager updates
2024-08-10 15:08:14 +02:00

68 lines
2.1 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{}
accountID, err := hand.Authentificate(ctx)
if err != nil {
return res, err
}
res, err = hand.lg.CreateServicePair(ctx, accountID, 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{}
accountID, err := hand.Authentificate(ctx)
if err != nil {
return res, err
}
res, err = hand.lg.RevokeServicePair(ctx, accountID, 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{}
accountID, err := hand.Authentificate(ctx)
if err != nil {
return res, err
}
res, err = hand.lg.UnrevokeServicePair(ctx, accountID, 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{}
accountID, err := hand.Authentificate(ctx)
if err != nil {
return res, err
}
res, err = hand.lg.ListServicePairs(ctx, accountID, 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{}
accountID, err := hand.Authentificate(ctx)
if err != nil {
return res, err
}
res, err = hand.lg.GetServicePair(ctx, accountID, params)
return res, err
}