Skip to content

Commit

Permalink
Omit decoder from ingest_stdin config
Browse files Browse the repository at this point in the history
  • Loading branch information
ronensc committed Sep 20, 2023
1 parent f512a94 commit 77aaf99
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
4 changes: 0 additions & 4 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@ Following is the supported API format for the standard input ingest:

<pre>
stdin:
decoder: decoder to use
type: (enum) one of the following:
json: JSON decoder
protobuf: Protobuf decoder
</pre>
## Transform Generic API
Following is the supported API format for generic transformations:
Expand Down
1 change: 0 additions & 1 deletion pkg/api/ingest_stdin.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@
package api

type IngestStdin struct {
Decoder Decoder `yaml:"decoder,omitempty" json:"decoder,omitempty" doc:"decoder to use"`
}
11 changes: 2 additions & 9 deletions pkg/pipeline/ingest/ingest_stdin.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package ingest

import (
"bufio"
"fmt"
"os"

"github.com/netobserv/flowlogs-pipeline/pkg/api"
Expand Down Expand Up @@ -95,18 +94,12 @@ func (s *ingestStdin) processRecord(out chan<- config.GenericMap, line string) {
// NewIngestStdin create a new ingester
func NewIngestStdin(opMetrics *operational.Metrics, params config.StageParam) (Ingester, error) {
slog.Debugf("Entering NewIngestStdin")
if params.Ingest == nil || params.Ingest.Stdin == nil || params.Ingest.Stdin.Decoder.Type == "" {
return nil, fmt.Errorf("stdin decoder not specified")
}
decoderType := params.Ingest.Stdin.Decoder.Type
if decoderType != api.DecoderName("JSON") {
return nil, fmt.Errorf("stdin supports only json decoder. Given decoder type: %v", decoderType)
}

in := make(chan string, channelSize)
eof := make(chan struct{})
metrics := newMetrics(opMetrics, params.Name, params.Ingest.Type, func() int { return len(in) })
decoder, err := decode.GetDecoder(params.Ingest.Stdin.Decoder)
decoderParams := api.Decoder{Type: api.DecoderName("JSON")}
decoder, err := decode.GetDecoder(decoderParams)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 77aaf99

Please sign in to comment.