directive

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InputTypeRequest = "request"
)

InputTypeRequest and others represent consts for Directives

View Source
const (
	NamespaceDefault = "default"
)

NamespaceDefault and others represent conts for namespaces

Variables

This section is empty.

Functions

This section is empty.

Types

type Alias added in v0.2.6

type Alias struct {
	Key   string
	Alias string
}

Alias is the parsed version of an entry in the `With` array from a CallableFn If you do user: activeUser, then activeUser is the state key and user is the key that gets put into the function's state (i.e. the alias)

type CallableFn added in v0.2.6

type CallableFn struct {
	Fn           string   `yaml:"fn,omitempty"`
	As           string   `yaml:"as,omitempty"`
	With         []string `yaml:"with,omitempty"`
	DesiredState []Alias  `yaml:"-"`
}

CallableFn is a fn along with its "variable name" and "args"

func (*CallableFn) ParseWith added in v0.2.6

func (c *CallableFn) ParseWith() ([]Alias, error)

ParseWith parses the fn's 'with' clause and returns the desired state

type Directive

type Directive struct {
	Identifier  string     `yaml:"identifier"`
	AppVersion  string     `yaml:"appVersion"`
	AtmoVersion string     `yaml:"atmoVersion"`
	Runnables   []Runnable `yaml:"runnables"`
	Handlers    []Handler  `yaml:"handlers,omitempty"`
	// contains filtered or unexported fields
}

Directive describes a set of functions and a set of handlers that take an input, and compose a set of functions to handle it

func (*Directive) FQFN added in v0.1.2

func (d *Directive) FQFN(fn string) (string, error)

FQFN returns the FQFN for a given function in the directive

func (*Directive) Marshal

func (d *Directive) Marshal() ([]byte, error)

Marshal outputs the YAML bytes of the Directive

func (*Directive) Unmarshal

func (d *Directive) Unmarshal(in []byte) error

Unmarshal unmarshals YAML bytes into a Directive struct it also calculates a map of FQFNs for later use

func (*Directive) Validate added in v0.1.0

func (d *Directive) Validate() error

Validate validates a directive

type Executable

type Executable struct {
	CallableFn `yaml:"callableFn,inline"`
	Group      []CallableFn `yaml:"group,omitempty"`
}

Executable represents an executable step in a handler

func (*Executable) IsFn added in v0.1.2

func (e *Executable) IsFn() bool

IsFn returns true if the executable is a group

func (*Executable) IsGroup added in v0.1.2

func (e *Executable) IsGroup() bool

IsGroup returns true if the executable is a group

type Handler

type Handler struct {
	Input    Input `yaml:"input,inline"`
	Steps    []Executable
	Response string `yaml:"response,omitempty"`
}

Handler represents the mapping between an input and a composition of functions

type Input

type Input struct {
	Type     string
	Method   string
	Resource string
}

Input represents an input source

type Runnable added in v0.2.6

type Runnable struct {
	Name       string `yaml:"name"`
	Namespace  string `yaml:"namespace"`
	Lang       string `yaml:"lang"`
	APIVersion string `yaml:"apiVersion,omitempty"`
}

Runnable is the structure of a .runnable.yaml file

Jump to

Keyboard shortcuts

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