From 59d67bde5f4b553b4f5ab562404d4a446ad2d607 Mon Sep 17 00:00:00 2001 From: Livio Spring Date: Fri, 7 Jul 2023 16:46:02 +0200 Subject: [PATCH] fix: return secret generators (#6159) --- internal/api/grpc/admin/iam_settings.go | 1 + internal/api/grpc/admin/iam_settings_converter.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/internal/api/grpc/admin/iam_settings.go b/internal/api/grpc/admin/iam_settings.go index cfbf285637..a4be248eec 100644 --- a/internal/api/grpc/admin/iam_settings.go +++ b/internal/api/grpc/admin/iam_settings.go @@ -18,6 +18,7 @@ func (s *Server) ListSecretGenerators(ctx context.Context, req *admin_pb.ListSec return nil, err } return &admin_pb.ListSecretGeneratorsResponse{ + Result: SecretGeneratorsToPb(result.SecretGenerators), Details: object.ToListDetails(result.Count, result.Sequence, result.Timestamp), }, nil } diff --git a/internal/api/grpc/admin/iam_settings_converter.go b/internal/api/grpc/admin/iam_settings_converter.go index c93f8fbf4f..7dfd1a381e 100644 --- a/internal/api/grpc/admin/iam_settings_converter.go +++ b/internal/api/grpc/admin/iam_settings_converter.go @@ -62,6 +62,14 @@ func UpdateSecretGeneratorToConfig(req *admin_pb.UpdateSecretGeneratorRequest) * } } +func SecretGeneratorsToPb(generators []*query.SecretGenerator) []*settings_pb.SecretGenerator { + list := make([]*settings_pb.SecretGenerator, len(generators)) + for i, generator := range generators { + list[i] = SecretGeneratorToPb(generator) + } + return list +} + func SecretGeneratorToPb(generator *query.SecretGenerator) *settings_pb.SecretGenerator { mapped := &settings_pb.SecretGenerator{ Length: uint32(generator.Length),