walk

package
v3.71.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LookupSchemaMapPath

func LookupSchemaMapPath(path SchemaPath, schemaMap shim.SchemaMap) (shim.Schema, error)

Similar to LookupSchemaPath but starts the initial step from a SchemaMap.

func LookupSchemaPath

func LookupSchemaPath(path SchemaPath, schema shim.Schema) (shim.Schema, error)

Finds a nested Schema at a given path.

func SortSchemaPaths added in v3.70.0

func SortSchemaPaths(paths []SchemaPath)

Provide a stable ordering of SchemaPaths.

Beyond determinism, there is no specific sort order.

func VisitSchema

func VisitSchema(schema shim.Schema, visitor SchemaVisitor)

Visit all nested schemas, including the current one.

func VisitSchemaMap

func VisitSchemaMap(schemaMap shim.SchemaMap, visitor SchemaVisitor)

Visit all nested schemas in a SchemaMap, keeping track of SchemaPath location.

Types

type ElementStep

type ElementStep struct{}

Drill down into a Map, Set or List element schema.

func (ElementStep) GoString

func (step ElementStep) GoString() string

func (ElementStep) Lookup

func (step ElementStep) Lookup(s shim.Schema) (shim.Schema, error)

type GetAttrStep

type GetAttrStep struct {
	Name string
}

Drill down into an attribute by the given attribute name.

func (GetAttrStep) GoString

func (step GetAttrStep) GoString() string

func (GetAttrStep) Lookup

func (step GetAttrStep) Lookup(s shim.Schema) (shim.Schema, error)

type SchemaPath

type SchemaPath []SchemaPathStep

Represents locations in a tfshim.Schema value as a sequence of steps to locate it.

An empty SchemaPath represents the current location.

Values of this type are immutable by convention, use Copy as necessary for local mutations.

func DecodeSchemaPath added in v3.69.0

func DecodeSchemaPath(path string) SchemaPath

func FromCtyPath

func FromCtyPath(path cty.Path) SchemaPath

Converts a value path to a Schema Path (zclconf package representation).

func FromHCtyPath

func FromHCtyPath(path hcty.Path) SchemaPath

Converts a value path to a Schema Path (hashicorp/go-cty representation).

func NewSchemaPath

func NewSchemaPath() SchemaPath

Builds a new empty SchemaPath.

func (SchemaPath) Copy

func (p SchemaPath) Copy() SchemaPath

func (SchemaPath) Element

func (p SchemaPath) Element() SchemaPath

func (SchemaPath) EncodeSchemaPath added in v3.69.0

func (p SchemaPath) EncodeSchemaPath() (string, error)

func (SchemaPath) GetAttr

func (p SchemaPath) GetAttr(name string) SchemaPath

func (SchemaPath) GoString

func (p SchemaPath) GoString() string

func (SchemaPath) MarshalJSON added in v3.70.0

func (p SchemaPath) MarshalJSON() ([]byte, error)

func (SchemaPath) MustEncodeSchemaPath added in v3.69.0

func (p SchemaPath) MustEncodeSchemaPath() string

func (*SchemaPath) UnmarshalJSON added in v3.70.0

func (p *SchemaPath) UnmarshalJSON(bytes []byte) error

func (SchemaPath) WithStep

func (p SchemaPath) WithStep(suffix SchemaPathStep) SchemaPath

type SchemaPathStep

type SchemaPathStep interface {
	GoString() string
	Lookup(shim.Schema) (shim.Schema, error)
	// contains filtered or unexported methods
}

Represents elements of a SchemaPath.

This interface is closed, the only the implementations given in the current package are allowed.

type SchemaVisitor

type SchemaVisitor = func(SchemaPath, shim.Schema)

Jump to

Keyboard shortcuts

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