diff --git a/sdk/plugin/grpc_system.go b/sdk/plugin/grpc_system.go index a05c14e1d0..bf66efc1ac 100644 --- a/sdk/plugin/grpc_system.go +++ b/sdk/plugin/grpc_system.go @@ -555,31 +555,13 @@ func (s *gRPCSystemViewServer) RegisterRotationJobWithResponse(ctx context.Conte } func (s *gRPCSystemViewServer) RegisterRotationJob(ctx context.Context, req *pb.RegisterRotationJobRequest) (*pb.RegisterRotationJobResponse, error) { - if s.impl == nil { - return nil, errMissingSystemView - } - - cfgReq := &rotation.RotationJobConfigureRequest{ - Name: req.Job.Name, - MountPoint: req.Job.MountPoint, - ReqPath: req.Job.Path, - RotationSchedule: req.Job.RotationSchedule, - RotationPolicy: req.Job.RotationPolicy, - // on the side inbound to vault, we convert seconds back to time.Duration - // Note: this value is seconds (as per the outbound client call, despite being int64) - // The field is int64 because of gRPC reasons, not time.Duration reasons - RotationWindow: time.Duration(req.Job.RotationWindow) * time.Second, - RotationPeriod: time.Duration(req.Job.RotationPeriod) * time.Second, - MigratedLegacyNextRotationTime: time.Unix(req.Job.MigratedLegacyNextRotationTime, 0).UTC(), - } - - rotationID, err := s.impl.RegisterRotationJob(ctx, cfgReq) + resp, err := s.RegisterRotationJobWithResponse(ctx, req) if err != nil { - return &pb.RegisterRotationJobResponse{}, status.Error(codes.Internal, err.Error()) + return &pb.RegisterRotationJobResponse{}, err } return &pb.RegisterRotationJobResponse{ - RotationID: rotationID, + RotationID: resp.GetInfo().GetRotationID(), }, nil }