Documentation ¶
Index ¶
- func BuildEvalContext(envVarsCtx *map[string]cty.Value, key string, ...) *hcl.EvalContext
- func BuildEvalContextFromMap(m *map[string]string, lm *map[string][]string) *map[string]cty.Value
- func CreateInputsMapCty(inputs []PluginInputConfig, key string, attributes hcl.Attributes, ...) map[string]cty.Value
- func DecodeHCLAttributeCty(attribute *hcl.Attribute, key string, envVals *map[string]cty.Value, ...) cty.Value
- func DecodeHCLListAttribute(attribute *hcl.Attribute, envVals *map[string]cty.Value, ...) string
- func GetBlocksFromConfig(hclFilePath string) []*hcl.Block
- func GetConfigFileSchema() *hcl.BodySchema
- func GetExprVars(block *hcl.Block) map[string][]hcl.Traversal
- func GetHCLEvalContextVarsFromEnv(varNames []string) *map[string]cty.Value
- func GetPluginAttributes(block *hcl.Block) []string
- func GetPluginConfigFileSchema() *hcl.BodySchema
- func GetPluginInputNames(pluginConfig *PluginConfig) []string
- func GetPluginInputSchema() *hcl.BodySchema
- func GetPluginOutputSchema() *hcl.BodySchema
- func GetResourceBlockSchema(pluginName string) *hcl.BodySchema
- type Config
- type PluginConfig
- type PluginInputConfig
- type PluginOutputConfig
- type ResourceConfig
- type VariableConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildEvalContext ¶
func BuildEvalContext(envVarsCtx *map[string]cty.Value, key string, runningVals *map[string]*map[string]cty.Value, runningValsNested *map[string]*map[string]*map[string]cty.Value) *hcl.EvalContext
BuildEvalContext builds an HCL evaluation context with all "DECKER_" environment variables available using "var" prefix in config files, and also loops over all the aggregated results maps from plugins that have run and makes them available for the next round of HCL decoding.
func BuildEvalContextFromMap ¶
BuildEvalContextFromMap takes a *map[string]string and returns a map of cty.Value to be used in an hcl EvalContext
func CreateInputsMapCty ¶
func CreateInputsMapCty(inputs []PluginInputConfig, key string, attributes hcl.Attributes, envVals *map[string]cty.Value, evalVals *map[string]*map[string]cty.Value, evalValsNested *map[string]*map[string]*map[string]cty.Value) map[string]cty.Value
CreateInputsMapCty decodes the HCL attributes with an evaluation context consisting of the outputs of all previously run plugins
func DecodeHCLAttributeCty ¶
func DecodeHCLAttributeCty(attribute *hcl.Attribute, key string, envVals *map[string]cty.Value, runningVals *map[string]*map[string]cty.Value, runningValsNested *map[string]*map[string]*map[string]cty.Value, defVal string) cty.Value
DecodeHCLAttributeCty calls BuildEvalContext() with the plugin results aggregated from each iterative run and attempts to decode a Block's Attribute's Expression using the context
func DecodeHCLListAttribute ¶
func DecodeHCLListAttribute(attribute *hcl.Attribute, envVals *map[string]cty.Value, runningVals *map[string]*map[string]cty.Value, runningValsNested *map[string]*map[string]*map[string]cty.Value) string
DecodeHCLListAttribute calls BuildEvalContext() with the plugin results aggregated from each iterative run and attempts to decode a Block's Attribute's Expression using the context. This is used in the "for_each" logic, not sure if its still needed.
func GetBlocksFromConfig ¶
GetBlocksFromConfig takes an HCL file path and return an go native Config, ordered array of the plugin names that should be run, and an ordered array of hcl.Block that need to be parsed
func GetConfigFileSchema ¶
func GetConfigFileSchema() *hcl.BodySchema
GetConfigFileSchema returns an hcl BodySchema that can be used to decode the top level HCL config file
func GetExprVars ¶
GetExprVars takes a block and a list of attribute names and will return a map of all the expression variables for those attributes.
func GetHCLEvalContextVarsFromEnv ¶
GetHCLEvalContextVarsFromEnv gets all environment variables with prefix "DECKER_" and creates a map with keys equal to the environment variable name but with "DECKER_" prefix stripped away, and the rest of the name is set to lower case. The values of the environment variables remain untouched. This allows HCL configuration blocks to use environment variables like "${var.my_environmment_variable}".
func GetPluginAttributes ¶
GetPluginAttributes returns a list of the plugin's attributes. This is used to determine whether or not for_each is set so main.go loops over the plugin instead of running it once.
func GetPluginConfigFileSchema ¶
func GetPluginConfigFileSchema() *hcl.BodySchema
GetPluginConfigFileSchema returns an hcl BodySchema that can be used to decode the top level Plugin HCL config files (specifying inputs and outputs for that plugin).
func GetPluginInputNames ¶
func GetPluginInputNames(pluginConfig *PluginConfig) []string
GetPluginInputNames takes an hcl.PluginConfig and returns an array of the names of its inputs (for building a resource block's schema)
func GetPluginInputSchema ¶
func GetPluginInputSchema() *hcl.BodySchema
GetPluginInputSchema returns an hcl BodySchema that can be used to decode a plugin's inputs in a plugin HCL config file
func GetPluginOutputSchema ¶
func GetPluginOutputSchema() *hcl.BodySchema
GetPluginOutputSchema returns an hcl BodySchema that can be used to decode a plugin's outputs in a plugin HCL config file
func GetResourceBlockSchema ¶
func GetResourceBlockSchema(pluginName string) *hcl.BodySchema
GetResourceBlockSchema takes a plugin name, determines its schema based on its HCL file's inputs, and returns the hcl.BodySchema which can be used to decode the "resource" blocks in an HCL config file
Types ¶
type Config ¶
type Config struct { TargetHost string `hcl:"target_host"` Variables []VariableConfig `hcl:"variable,block"` Resources []ResourceConfig `hcl:"resource,block"` }
Config is used in conjunction with gohcl to decode HCL attributes into native Go structs.
type PluginConfig ¶
type PluginConfig struct { Inputs []PluginInputConfig `hcl:"input,block"` Outputs []PluginOutputConfig `hcl:"output,block"` }
PluginConfig is used in conjunction with gohcl to decode HCL attributes into native Go structs.
func GetPluginContent ¶
func GetPluginContent(forEach bool, block *hcl.Block, hclFilePath string) (*PluginConfig, *hcl.BodyContent)
GetPluginContent takes a *hcl.Block and a path to an HCL config file and returns the BodyContent
type PluginInputConfig ¶
type PluginInputConfig struct { Name string `hcl:"name,label"` Type string `hcl:"type"` Default string `hcl:"default"` Remain hcl.Body `hcl:",remain"` }
PluginInputConfig is used in conjunction with gohcl to decode HCL attributes into native Go structs.
type PluginOutputConfig ¶
type PluginOutputConfig struct { Name string `hcl:"name,label"` Type string `hcl:"type"` Remain hcl.Body `hcl:",remain"` }
PluginOutputConfig is used in conjunction with gohcl to decode HCL attributes into native Go structs.
type ResourceConfig ¶
type ResourceConfig struct { PluginName string `hcl:"plugin_name,label"` UniqueID string `hcl:"unique_id,label"` Host string `hcl:"host"` PluginEnabled string `hcl:"plugin_enabled"` Remain hcl.Body `hcl:",remain"` }
ResourceConfig is used in conjunction with gohcl to decode HCL attributes into native Go structs.
func DecodeHCLResourceBlock ¶
func DecodeHCLResourceBlock(block *hcl.Block, envVals *map[string]cty.Value, runningVals *map[string]*map[string]cty.Value, runningValsNested *map[string]*map[string]*map[string]cty.Value) *ResourceConfig
THIS IS NOT BEING USED ANYWHERE DecodeHCLResourceBlock calls BuildEvalContext() with the plugin results aggregated from each iterative run and attempts to decode a Resource block with the latest context (this is the magic allowing outputs from one plugin to work as inputs to another)