fix: return secret generators (#6159)

This commit is contained in:
Livio Spring 2023-07-07 16:46:02 +02:00 committed by GitHub
parent a5b4319f1f
commit 59d67bde5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -18,6 +18,7 @@ func (s *Server) ListSecretGenerators(ctx context.Context, req *admin_pb.ListSec
return nil, err return nil, err
} }
return &admin_pb.ListSecretGeneratorsResponse{ return &admin_pb.ListSecretGeneratorsResponse{
Result: SecretGeneratorsToPb(result.SecretGenerators),
Details: object.ToListDetails(result.Count, result.Sequence, result.Timestamp), Details: object.ToListDetails(result.Count, result.Sequence, result.Timestamp),
}, nil }, nil
} }

View File

@ -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 { func SecretGeneratorToPb(generator *query.SecretGenerator) *settings_pb.SecretGenerator {
mapped := &settings_pb.SecretGenerator{ mapped := &settings_pb.SecretGenerator{
Length: uint32(generator.Length), Length: uint32(generator.Length),