MCPcopy
hub / github.com/hashicorp/hcl / Spec

Interface Spec

hcldec/spec.go:23–45  ·  hcldec/spec.go::Spec

A Spec is a description of how to decode a hcl.Body to a cty.Value. The various other types in this package whose names end in "Spec" are the spec implementations. The most common top-level spec is ObjectSpec, which decodes body content into a cty.Value of an object type.

Source from the content-addressed store, hash-verified

21// the spec implementations. The most common top-level spec is ObjectSpec,
22// which decodes body content into a cty.Value of an object type.
23type Spec interface {
24 // Perform the decode operation on the given body, in the context of
25 // the given block (which might be null), using the given eval context.
26 //
27 // "block" is provided only by the nested calls performed by the spec
28 // types that work on block bodies.
29 decode(content *hcl.BodyContent, blockLabels []blockLabel, ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics)
30
31 // Return the cty.Type that should be returned when decoding a body with
32 // this spec.
33 impliedType() cty.Type
34
35 // Call the given callback once for each of the nested specs that would
36 // get decoded with the same body and block as the receiver. This should
37 // not descend into the nested specs used when decoding blocks.
38 visitSameBodyChildren(cb visitFunc)
39
40 // Determine the source range of the value that would be returned for the
41 // spec in the given content, in the context of the given block
42 // (which might be null). If the corresponding item is missing, return
43 // a place where it might be inserted.
44 sourceRange(content *hcl.BodyContent, blockLabels []blockLabel) hcl.Range
45}
46
47type visitFunc func(spec Spec)
48

Callers 26

decodeMethod · 0.65
decodeMethod · 0.65
decodeMethod · 0.65
decodeMethod · 0.65
decodeMethod · 0.65
decodeMethod · 0.65
decodeMethod · 0.65
decodeFunction · 0.65
impliedTypeMethod · 0.65
impliedTypeMethod · 0.65
decodeMethod · 0.65
impliedTypeMethod · 0.65

Implementers 15

AttrSpechcldec/spec.go
LiteralSpechcldec/spec.go
ExprSpechcldec/spec.go
BlockSpechcldec/spec.go
BlockListSpechcldec/spec.go
BlockTupleSpechcldec/spec.go
BlockSetSpechcldec/spec.go
BlockMapSpechcldec/spec.go
BlockObjectSpechcldec/spec.go
BlockAttrsSpechcldec/spec.go
BlockLabelSpechcldec/spec.go
DefaultSpechcldec/spec.go

Calls

no outgoing calls

Tested by

no test coverage detected