addrs

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: MPL-2.0 Imports: 2 Imported by: 1

README

Documentation

Overview

Package addrs contains types that represent "addresses", which are references to specific objects within a Packer configuration.

All addresses have string representations based on HCL traversal syntax which should be used in the user-interface, and also in-memory representations that can be used internally.

All types within this package should be treated as immutable, even if this is not enforced by the Go compiler. It is always an implementation error to modify an address object in-place after it is initially constructed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InputVariable

type InputVariable struct {
	Name string
	// contains filtered or unexported fields
}

InputVariable is the address of an input variable.

func (InputVariable) String

func (v InputVariable) String() string

type Reference

type Reference struct {
	Subject     Referenceable
	SourceRange hcl.Range
	Remaining   hcl.Traversal
}

Reference describes a reference to an address with source location information.

func ParseRef

func ParseRef(traversal hcl.Traversal) (*Reference, hcl.Diagnostics)

ParseRef attempts to extract a referencable address from the prefix of the given traversal, which must be an absolute traversal or this function will panic.

If no error diagnostics are returned, the returned reference includes the address that was extracted, the source range it was extracted from, and any remaining relative traversal that was not consumed as part of the reference.

If error diagnostics are returned then the Reference value is invalid and must not be used.

type Referenceable

type Referenceable interface {

	// String produces a string representation of the address that could be
	// parsed as a HCL traversal and passed to ParseRef to produce an identical
	// result.
	String() string
	// contains filtered or unexported methods
}

Referenceable is an interface implemented by all address types that can appear as references in configuration language expressions.

Jump to

Keyboard shortcuts

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