recipe

package
v0.8.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidRecipeVersion = errors.New("recipe version is invalid or not found")
)

Functions

func FromTemplate

func FromTemplate(config TemplateConfig) error

Types

type PluginNode

type PluginNode struct {
	Name   yaml.Node            `json:"name" yaml:"name"`
	Type   yaml.Node            `json:"type" yaml:"type"`
	Scope  yaml.Node            `json:"scope" yaml:"scope"`
	Config map[string]yaml.Node `json:"config" yaml:"config"`
}

PluginNode contains the json data for a recipe node that is being used for generating the plugins code for a recipe.

type PluginRecipe

type PluginRecipe struct {
	Name   string                 `json:"name" yaml:"name" validate:"required"`
	Scope  string                 `json:"scope" yaml:"scope"`
	Config map[string]interface{} `json:"config" yaml:"config"`
	Node   PluginNode
}

PluginRecipe contains the json data for a recipe that is being used for generating the plugins code for a recipe.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader is a struct that reads recipe files.

func NewReader

func NewReader(lg log.Logger, pathToConfig string) *Reader

NewReader returns a new Reader.

func (*Reader) Read

func (r *Reader) Read(path string) (recipes []Recipe, err error)

Read loads the list of recipes from a give file or directory path.

type Recipe

type Recipe struct {
	Name       string         `json:"name" yaml:"name" validate:"required"`
	Version    string         `json:"version" yaml:"version" validate:"required"`
	Source     PluginRecipe   `json:"source" yaml:"source" validate:"required"`
	Sinks      []PluginRecipe `json:"sinks" yaml:"sinks" validate:"required,min=1"`
	Processors []PluginRecipe `json:"processors" yaml:"processors"`
	Node       RecipeNode
}

Recipe contains the json data for a recipe

type RecipeNode

type RecipeNode struct {
	Name       yaml.Node    `json:"name" yaml:"name"`
	Version    yaml.Node    `json:"version" yaml:"version"`
	Source     PluginNode   `json:"source" yaml:"source"`
	Sinks      []PluginNode `json:"sinks" yaml:"sinks"`
	Processors []PluginNode `json:"processors" yaml:"processors"`
}

RecipeNode contains the json data for a recipe node

type TemplateConfig

type TemplateConfig struct {
	TemplateFilePath string
	OutputDirPath    string
	DataPath         string
	Data             []TemplateData
}

type TemplateData

type TemplateData struct {
	FileName string                 `json:"FileName" yaml:"FileName"`
	Data     map[string]interface{} `json:"Data" yaml:"Data"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL