Documentation
¶
Index ¶
- func ConfigSpec() docs.FieldSpecs
- func FieldConfigSpec() docs.FieldSpecs
- func InitTemplates(env *bundle.Environment, bloblEnv *bloblang.Environment, ...) ([]string, error)
- func RegisterTemplateYAML(env *bundle.Environment, bloblEnv *bloblang.Environment, template []byte) error
- func WithMetricsMapping(nm bundle.NewManagement, m *metrics.Mapping) bundle.NewManagement
- type Config
- type FieldConfig
- type TestConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigSpec ¶
func ConfigSpec() docs.FieldSpecs
ConfigSpec returns a configuration spec for a template.
func FieldConfigSpec ¶
func FieldConfigSpec() docs.FieldSpecs
FieldConfigSpec returns a configuration spec for a field of a template.
func InitTemplates ¶
func InitTemplates(env *bundle.Environment, bloblEnv *bloblang.Environment, templatesPaths ...string) ([]string, error)
InitTemplates parses and registers native templates, as well as templates at paths provided, and returns any linting errors that occur.
func RegisterTemplateYAML ¶
func RegisterTemplateYAML(env *bundle.Environment, bloblEnv *bloblang.Environment, template []byte) error
RegisterTemplateYAML attempts to register a new template component to the specified environment.
func WithMetricsMapping ¶
func WithMetricsMapping(nm bundle.NewManagement, m *metrics.Mapping) bundle.NewManagement
WithMetricsMapping attempts to wrap the metrics of a manager with a metrics mapping.
Types ¶
type Config ¶
type Config struct {
Name string `yaml:"name"`
Type string `yaml:"type"`
Status string `yaml:"status"`
Categories []string `yaml:"categories"`
Summary string `yaml:"summary"`
Description string `yaml:"description"`
Fields []FieldConfig `yaml:"fields"`
Mapping string `yaml:"mapping"`
MetricsMapping string `yaml:"metrics_mapping"`
Tests []TestConfig `yaml:"tests"`
}
Config describes a Benthos component template.
func ReadConfigFile ¶
func ReadConfigFile(env *bundle.Environment, path string) (conf Config, lints []docs.Lint, err error)
ReadConfigFile attempts to read a template configuration file.
func ReadConfigYAML ¶
func ReadConfigYAML(env *bundle.Environment, templateBytes []byte) (conf Config, lints []docs.Lint, err error)
ReadConfigYAML attempts to read a YAML byte slice as a template configuration file.
func (Config) ComponentSpec ¶
func (c Config) ComponentSpec() (docs.ComponentSpec, error)
ComponentSpec creates a documentation component spec from a template config.
func (Config) Test ¶
func (c Config) Test(env *bundle.Environment, benv *bloblang.Environment) ([]string, error)
Test ensures that the template compiles, and executes any unit test definitions within the config.
type FieldConfig ¶
type FieldConfig struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Type *string `yaml:"type,omitempty"`
Kind *string `yaml:"kind,omitempty"`
Default *any `yaml:"default,omitempty"`
Advanced bool `yaml:"advanced"`
Options any `yaml:"options,omitempty"`
}
FieldConfig describes a configuration field used in the template.