/
files.go
48 lines (40 loc) · 1.48 KB
/
files.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package output
import (
"github.com/Jeffail/benthos/v3/internal/docs"
"github.com/Jeffail/benthos/v3/lib/log"
"github.com/Jeffail/benthos/v3/lib/metrics"
"github.com/Jeffail/benthos/v3/lib/output/writer"
"github.com/Jeffail/benthos/v3/lib/types"
)
//------------------------------------------------------------------------------
func init() {
Constructors[TypeFiles] = TypeSpec{
constructor: fromSimpleConstructor(NewFiles),
Status: docs.StatusDeprecated,
Summary: `
Writes each individual message to a new file.`,
Description: `
## Alternatives
The functionality of this output is now supported by the ` + "[`file`](/docs/components/outputs/file)" + ` output.
In order for each message to create a new file the path must use function
interpolations as described [here](/docs/configuration/interpolation#bloblang-queries).`,
FieldSpecs: docs.FieldSpecs{
docs.FieldCommon("path", "The file to write to, if the file does not yet exist it will be created.").IsInterpolated(),
},
Categories: []Category{
CategoryLocal,
},
}
}
//------------------------------------------------------------------------------
// NewFiles creates a new Files output type.
func NewFiles(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error) {
f, err := writer.NewFilesV2(conf.Files, mgr, log, stats)
if err != nil {
return nil, err
}
return NewWriter(
TypeFiles, f, log, stats,
)
}
//------------------------------------------------------------------------------