plugin

package
v0.0.0-...-173f61c Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package plugin content relative to the package

Index

Constants

View Source
const (
	// ArgDesc contains the name of the argument used in the plugins block.
	ArgDesc = "_desc"
	// 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"
)

Variables

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

BaseArguments contain the list of common attributes.

View Source
var BaseBlocks = []hcl.BlockHeaderSchema{
	{
		Type:       use.BlockUse,
		LabelNames: []string{use.ArgRef},
	},
}

BaseBlocks contains block definitions for plugins.

Functions

func ExecutePlugin

func ExecutePlugin(ctx execution.FeatureContext, plugin *Base, fn ExecuteFn) errors.Error

ExecutePlugin 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 IsPluginBaseBlock

func IsPluginBaseBlock(name string) bool

IsPluginBaseBlock return true if the block is a common block.

func SetBaseArgs

func SetBaseArgs(plugin Plugin, attribute *hcl.Attribute) errors.Error

SetBaseArgs set the common arguments.

func SetBaseBlock

func SetBaseBlock(plugin Plugin, blockType string, blocks hcl.Blocks) errors.Error

SetBaseBlock set the common blocks.

Types

type Base

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

Base contain the common attributes of all the plugins.

func (*Base) AddBlockUse

func (s *Base) AddBlockUse(entry *use.Use)

AddBlockUse add block use.

func (*Base) Description

func (s *Base) Description() string

Description return block description.

func (*Base) ExtraAValues

func (s *Base) ExtraAValues() map[string]cty.Value

ExtraAValues return inherited values.

func (*Base) PopulateValuesWithExtraValues

func (s *Base) PopulateValuesWithExtraValues(ctx *hcl.EvalContext) errors.Error

PopulateValuesWithExtraValues populate the common attributes.

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) 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) String

func (s *Base) String() string

String default method String.

type BaseInterface

type BaseInterface interface {
	SetDesc(string)
	SetWhen(hcl.Expression)
	SetWhile(hcl.Expression)
	SetKind(string)
	String() string
	Description() string
	AddBlockUse(use *use.Use)
	SetCount(hcl.Expression)
	PopulateValuesWithExtraValues(*hcl.EvalContext) errors.Error
}

BaseInterface contains common methods to be implemented by any interface.

type ExecuteFn

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

ExecuteFn defined type to be implemented by the plugins.

type Plugin

type Plugin interface {
	BaseInterface
	Execute(ctx execution.FeatureContext) errors.Error
}

Plugin interface to be implemented by any plugin.

type Plugins

type Plugins []Plugin

Plugins list of elements of tpye Plugin.

Directories

Path Synopsis
Package use contains types and methods to deal with block use
Package use contains types and methods to deal with block use

Jump to

Keyboard shortcuts

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