hcl

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertHCLSyntaxToHCLWrite

func ConvertHCLSyntaxToHCLWrite(syntaxTokens hclsyntax.Tokens) hclwrite.Tokens

Types

type ConfigType

type ConfigType string

ConfigType represents the type of configuration (static or dynamic)

const (
	ConfigTypeStatic  ConfigType = "static"
	ConfigTypeDynamic ConfigType = "dynamic"
)

type HclField

type HclField struct {
	Type      ConfigType  `hcl:"type" json:"type"`
	Static    interface{} `hcl:"static,optional" json:"static,omitempty"`
	Dynamic   string      `hcl:"dynamic,optional" json:"dynamic,omitempty"`
	ValueType ValueType   `hcl:"value_type" json:"value_type"`
}

HclField represents a field in HCL that can be either static or dynamic

type HclGenerator

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

HclGenerator provides functionality to generate HCL from structs

func NewHclGenerator

func NewHclGenerator(blockType string, blockLabels []string) *HclGenerator

NewHclGenerator creates a new HclGenerator

func (*HclGenerator) GenerateHCL

func (g *HclGenerator) GenerateHCL(config interface{}) (string, error)

GenerateHCL generates HCL from a struct using reflection

type ValueType

type ValueType string

ValueType represents the type of value stored in HclField

const (
	ValueTypeString     ValueType = "string"
	ValueTypeBool       ValueType = "bool"
	ValueTypeStringMap  ValueType = "string_map"
	ValueTypeStringList ValueType = "string_list"
	ValueTypeBlock      ValueType = "block"
)

Jump to

Keyboard shortcuts

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