in server/cmd/harp-server/internal/dispatchers/grpc/server/bundle.go [42:66]
func (s *grpcBundleServer) GetSecret(ctx context.Context, req *bundlev1.GetSecretRequest) (*bundlev1.GetSecretResponse, error) {
// Check arguments
if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "request is nil")
}
if req.Namespace == "" {
return nil, status.Errorf(codes.InvalidArgument, "namespace could not be blank")
}
if req.Path == "" {
return nil, status.Errorf(codes.InvalidArgument, "path could not be blank")
}
// Delegate to engine to retrieve secret
content, err := s.bm.GetSecret(ctx, req.Namespace, req.Path)
if err != nil {
return nil, status.Errorf(codes.NotFound, "Secret '%s' could not be retrieved from '%s' namespace", req.Path, req.Namespace)
}
// Return result
return &bundlev1.GetSecretResponse{
Namespace: req.Namespace,
Path: req.Path,
Content: content,
}, nil
}