hcl

package
v0.55.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSpecFileUndefined is returned if a file wasn't specified
	ErrSpecFileUndefined = errors.New("hcl file undefined")
	// ErrSpecPathUndefined is returned if a path wasn't specified
	ErrSpecPathUndefined = errors.New("hcl path undefined")
	// ErrSpecFileAndFilesDefined when we both spec File and Files have been specified
	ErrSpecFileAndFilesDefined = errors.New("parameter \"file\" and \"files\" are mutually exclusive")
	// ErrWrongSpec is returned when the Spec has wrong content
	ErrWrongSpec error = errors.New("wrong spec content")
)

Functions

This section is empty.

Types

type Hcl

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

func New

func New(spec interface{}) (*Hcl, error)

func (*Hcl) Apply

func (h *Hcl) Apply(filePath string, valueToWrite string) error

func (*Hcl) Changelog

func (h *Hcl) Changelog() string

Changelog returns the changelog for this resource, or an empty string if not supported

func (*Hcl) Condition

func (h *Hcl) Condition(source string, scm scm.ScmHandler, resultCondition *result.Condition) error

func (*Hcl) Query

func (h *Hcl) Query(resourceFile file) (string, error)

func (*Hcl) Read

func (h *Hcl) Read() error

Read puts the content of the file(s) as value of the y.files map if the file(s) exist(s) or log the non existence of the file

func (*Hcl) Source

func (h *Hcl) Source(workingDir string, resultSource *result.Source) error

func (*Hcl) Target

func (h *Hcl) Target(source string, scm scm.ScmHandler, dryRun bool, resultTarget *result.Target) error

func (*Hcl) UpdateAbsoluteFilePath

func (h *Hcl) UpdateAbsoluteFilePath(workDir string)

type Spec

type Spec struct {
	/*
		"file" defines the hcl file path to interact with.

		compatible:
			* source
			* condition
			* target

		remark:
			* "file" and "files" are mutually exclusive
			* protocols "https://", "http://", and "file://" are supported in path for source and condition
	*/
	File string `yaml:",omitempty"`
	/*
		"files" defines the list of hcl files path to interact with.

		compatible:
			* source
			* condition
			* target

		remark:
			* file and files are mutually exclusive
			* when using as a source only one file is supported
			* protocols "https://", "http://", and "file://" are supported in file path for source and condition
	*/
	Files []string `yaml:",omitempty"`
	/*
		"path" defines the hcl attribute path.

		compatible:
			* source
			* condition
			* target

		example:
			* path: resource.aws_instance.app_server.ami
			* path: resource.helm_release.prometheus.version
			* path: plugin.aws.version

	*/
	Path string `yaml:",omitempty"`
	/*
		"value" is the value associated with a hcl path.

		compatible:
			* condition
			* target

		default:
			When used from a condition or a target, the default value is set to linked source output.
	*/
	Value string `yaml:",omitempty"`
}

"hcl" defines the specification for manipulating "hcl" files. It can be used as a "source", a "condition", or a "target".

func (*Spec) Validate

func (s *Spec) Validate() error

Jump to

Keyboard shortcuts

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