actions

package
v0.0.1-beta1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ArgDesc contains the name of the argument used in the plugins block.
	ArgDesc = "description"
	// ArgWhen contains the name of the argument used in the plugins block.
	ArgWhen = "when"
	// ArgWhile contains the name of the argument used in the plugins block.
	ArgWhile = "while"
	// ArgCount contains the name of the argument used in the plugins block.
	ArgCount = "count"
	// ArgItems contains the name of the slice to be iterated over.
	ArgItems = "items"
)

Variables

View Source
var BaseArguments = []hcl.AttributeSchema{
	{Name: ArgDesc, Required: false},
	{Name: ArgWhen, Required: false},
	{Name: ArgWhile, Required: false},
	{Name: ArgCount, Required: false},
	{Name: ArgItems, Required: false},
}

BaseArguments contain the list of common attributes.

Functions

func Execute

func Execute(ctx context.FeatureContext, action *Base, fn ExecuteFn) errors.Error

Execute Given a plugin and the context is executed.

func IsPluginBaseArgument

func IsPluginBaseArgument(name string) bool

IsPluginBaseArgument returns true if the name is common for all the plugins.

func SetBaseArgs

func SetBaseArgs(action Action, attribute *hcl.Attribute) errors.Error

SetBaseArgs set the common arguments.

Types

type Action

type Action interface {
	SetDesc(string)
	SetWhen(hcl.Expression)
	SetCount(hcl.Expression)
	SetWhile(hcl.Expression)
	SetItems(hcl.Expression)
	SetKind(string)
	Description() string
	String() string
	ShouldExecute(ctx *hcl.EvalContext) bool
	Execute(ctx context.FeatureContext) errors.Error
}

Action interface to be implemented by any action.

type Actions

type Actions []Action

type Base

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

Base contain the common attributes of all the plugins.

func (*Base) Description

func (s *Base) Description() string

Description return block description.

func (*Base) SetCount

func (s *Base) SetCount(count hcl.Expression)

SetCount set attribute count.

func (*Base) SetDesc

func (s *Base) SetDesc(desc string)

SetDesc set description for the block.

func (*Base) SetItems

func (s *Base) SetItems(items hcl.Expression)

SetCount set attribute count.

func (*Base) SetKind

func (s *Base) SetKind(kind string)

SetKind set attribute kind.

func (*Base) SetWhen

func (s *Base) SetWhen(when hcl.Expression)

SetWhen set attribute when.

func (*Base) SetWhile

func (s *Base) SetWhile(while hcl.Expression)

SetWhile set attribute while.

func (*Base) ShouldExecute

func (s *Base) ShouldExecute(ctx *hcl.EvalContext) bool

func (*Base) String

func (s *Base) String() string

String default method String.

type Decoder

type Decoder interface {
	BlockHeaderSchema() hcl.BlockHeaderSchema
	DecodeBlock(block *hcl.Block) (Action, errors.Error)
}

Decoder interface to be implemented bu the plugin Decoders.

type ExecuteFn

type ExecuteFn func(ctx context.FeatureContext) errors.Error

ExecuteFn defined type to be implemented by the plugins.

Directories

Path Synopsis
Package assert contains types and methods used by the plugin
Package assert contains types and methods used by the plugin
Package pprint contains the root elements required by the plugin
Package pprint contains the root elements required by the plugin
internal
Package internal contains not exported types and functions
Package internal contains not exported types and functions
Package plugins contain the types and method to deal with plugins
Package plugins contain the types and method to deal with plugins
Package set contain types and method to deal with this plugin
Package set contain types and method to deal with this plugin

Jump to

Keyboard shortcuts

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