Documentation ¶
Index ¶
- Constants
- func GetSequencePath(seq string) (string, error)
- func GetUsersPath() string
- func IsSequenceAllowed(seq string) bool
- func PrototypeCheck(config map[string]any, schema string) error
- func SetDefault(config map[string]any, key string, value any) map[string]any
- type FileOp
- type Filter
- type IFilter
- type IOperation
- type JsonParseFilter
- type MongoOp
- type NixShellOp
- type ProcessResult
- type Proto
- type RegexpReplaceFilter
- type Scope
- func (s *Scope) InsertParams(data map[string]any)
- func (s *Scope) LoadEnvs(envs []string)
- func (s *Scope) PushResult(name string, value any, hide bool)
- func (s *Scope) Render(ctx context.Context, data string) (string, error)
- func (s *Scope) RenderMap(ctx context.Context, config map[string]any) (map[string]any, error)
- func (s *Scope) ToJSON() string
- func (s *Scope) ToProcessResult() ProcessResult
- type Sequence
- type SplitFilter
- type SplitLinesFilter
- type SqlOp
- type Step
- type StepResult
- type TemplateOp
- type WaitOp
- type YamlParseFilter
Constants ¶
const EnvValuesPath = "VALUES_PATH"
const EnvValuesPathDefault = "etc/values.yaml"
const FilterJsonParse = "jsonParse"
const FilterReplace = "replace"
const FilterSplit = "split"
const FilterSplitLines = "splitLines"
const FilterYamlParse = "yamlParse"
const OpFile = "file"
const OpMongo = "mongo"
const OpNixShell = "nixShellCommand"
const OpSql = "sql"
const OpTemplate = "template"
const OpWait = "wait"
const VarParams = "Params"
const VarValues = "Values"
Variables ¶
This section is empty.
Functions ¶
func GetSequencePath ¶
func GetUsersPath ¶
func GetUsersPath() string
func IsSequenceAllowed ¶ added in v0.1.1
Types ¶
type FileOp ¶ added in v0.4.0
type FileOp struct { Path string BasePath string Raw bool Result any // contains filtered or unexported fields }
type Filter ¶
Filter is the wrapping structure of all filters
func (*Filter) GetImplementation ¶
GetImplementation will return the IFilter proper implementation
type IOperation ¶
IOperation is the interface for operations
type JsonParseFilter ¶
type JsonParseFilter struct{}
JsonParseFilter is a filter that transforms text to a JSON structure
func NewJsonParseFilter ¶
func NewJsonParseFilter() *JsonParseFilter
NewJsonParseFilter is the constructor for JsonParseFilter
type MongoOp ¶
type MongoOp struct { URI string Find map[string]any DB string Collection string Timeout time.Duration Result any // contains filtered or unexported fields }
MongoOp is the MongoDB database
func NewMongoOp ¶
NewMongoOp is the constructor for MongoOp
type NixShellOp ¶
type NixShellOp struct { Command string Stdin bool Result string Timeout time.Duration // contains filtered or unexported fields }
NixShellOp is an operation that runs a *NIX command
func NewNixShellIOp ¶
func NewNixShellIOp(config map[string]any, scope *Scope) (*NixShellOp, error)
NewNixShellIOp constructor for NixShellOp
func (*NixShellOp) GetResult ¶
func (o *NixShellOp) GetResult() any
GetResult returns the result of the operation
type ProcessResult ¶
type ProcessResult struct { Description string `json:"description"` Results []StepResult `json:"results"` Errors map[string]string `json:"errors"` }
ProcessResult is the final result of a sequence execution
func (*ProcessResult) ToJSON ¶
func (r *ProcessResult) ToJSON() []byte
ToJSON will turn the Result data structure into a JSON string
type RegexpReplaceFilter ¶
RegexpReplaceFilter is a filter that will take an input and replace any matching pattern described by Regexp with the value of Replace
func NewRegexpReplaceFilter ¶
func NewRegexpReplaceFilter(config map[string]any) (*RegexpReplaceFilter, error)
NewRegexpReplaceFilter is the constructor for RegexpReplaceFilter
type Scope ¶
type Scope struct { Scope map[string]any Env []string Results []StepResult Errors map[string]string }
Scope is the variable Scope of the sequence
func (*Scope) InsertParams ¶
InsertParams inserts the params expressed as JSON into the Scope
func (*Scope) PushResult ¶
PushResult will store the result into the Scope and in the "Results" structure
func (*Scope) RenderMap ¶
RenderMap will recursively traverse a map and try to render all strings it finds
func (*Scope) ToProcessResult ¶
func (s *Scope) ToProcessResult() ProcessResult
ToProcessResult converts the internal representation of results, to a publishable version
type Sequence ¶
type Sequence struct { Env []string `yaml:"env"` Description string `yaml:"description"` Steps []*Step `yaml:"steps"` AcceptParams bool `yaml:"accept_params"` Requires any `yaml:"requires"` Scope *Scope }
Sequence is a sequence of operations
func LoadSequence ¶
LoadSequence loads a sequence from a file path
func (*Sequence) CheckRequires ¶
CheckRequires will check that the provided map has at least the fields described in the "Requires" list
func (*Sequence) Result ¶
func (s *Sequence) Result() ProcessResult
Result will return publishable results for the sequence
type SplitFilter ¶
type SplitFilter struct {
Sep string
}
SplitFilter splits a string into an array based on a separation character. If the input is an array, the output will be an array of arrays
func NewSplitFilter ¶
func NewSplitFilter(config map[string]any) (*SplitFilter, error)
NewSplitFilter is the constructor for SplitFilter
type SplitLinesFilter ¶
type SplitLinesFilter struct{}
SplitLinesFilter takes the input as string and splits the lines, returning an array
func NewSplitLinesFilter ¶
func NewSplitLinesFilter() *SplitLinesFilter
NewSplitLinesFilter is the constructor for SplitLinesFilter
type SqlOp ¶
type SqlOp struct { Driver string URI string Select string Timeout time.Duration Result []map[string]any // contains filtered or unexported fields }
SqlOp is the operation that runs SQL queries
type Step ¶
type Step struct { Name string `yaml:"name"` Type string `yaml:"type"` Config map[string]any `yaml:"config"` Filters []Filter `yaml:"filters"` Hide bool `yaml:"hide"` // contains filtered or unexported fields }
Step is one step in a sequence
func (*Step) GetImplementation ¶
func (s *Step) GetImplementation() (IOperation, error)
GetImplementation will return the proper IOperation implementation for the current step
type StepResult ¶
StepResult is the outcome of one step
type TemplateOp ¶
TemplateOp is an operation that evaluates a template
func NewTemplateOp ¶
func NewTemplateOp(config map[string]any, scope *Scope) (*TemplateOp, error)
NewTemplateOp is the constructor for TemplateOp
type WaitOp ¶
type WaitOp struct {
// contains filtered or unexported fields
}
WaitOp is an operation that pauses the sequence for a certain amount of time
type YamlParseFilter ¶ added in v0.4.0
type YamlParseFilter struct{}
YamlParseFilter is a filter that transforms text to a YAML structure
func NewYamlParseFilter ¶ added in v0.4.0
func NewYamlParseFilter() *YamlParseFilter
NewYamlParseFilter is the constructor for YamlParseFilter