block

package
v0.58.2 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TypeData = Type{
	// contains filtered or unexported fields
}
View Source
var TypeLocal = Type{
	// contains filtered or unexported fields
}
View Source
var TypeModule = Type{
	// contains filtered or unexported fields
}
View Source
var TypeOutput = Type{
	// contains filtered or unexported fields
}
View Source
var TypeProvider = Type{
	// contains filtered or unexported fields
}
View Source
var TypeResource = Type{
	// contains filtered or unexported fields
}
View Source
var TypeTerraform = Type{
	// contains filtered or unexported fields
}
View Source
var TypeVariable = Type{
	// contains filtered or unexported fields
}

Functions

func IsValidBlockReference

func IsValidBlockReference(name string) bool

func IsValidType

func IsValidType(name string) bool

Types

type Attribute

type Attribute interface {
	IsLiteral() bool
	Type() cty.Type
	Value() cty.Value
	Range() Range
	Name() string
	Contains(checkValue interface{}, equalityOptions ...EqualityOption) bool
	NotContains(checkValue interface{}, equalityOptions ...EqualityOption) bool
	HasIntersect(checkValues ...interface{}) bool
	StartsWith(prefix interface{}) bool
	EndsWith(suffix interface{}) bool
	Equals(checkValue interface{}, equalityOptions ...EqualityOption) bool
	NotEqual(checkValue interface{}, equalityOptions ...EqualityOption) bool
	RegexMatches(pattern interface{}) bool
	IsAny(options ...interface{}) bool
	IsNotAny(options ...interface{}) bool
	IsNone(options ...interface{}) bool
	IsTrue() bool
	IsFalse() bool
	IsEmpty() bool
	IsNil() bool
	IsNotNil() bool
	MapValue(mapKey string) cty.Value
	LessThan(checkValue interface{}) bool
	LessThanOrEqualTo(checkValue interface{}) bool
	GreaterThan(checkValue interface{}) bool
	GreaterThanOrEqualTo(checkValue interface{}) bool
	IsDataBlockReference() bool
	Reference() (*Reference, error)
	AllReferences() []*Reference
	IsResourceBlockReference(resourceType string) bool
	ReferencesBlock(b Block) bool
	IsResolvable() bool
	IsNotResolvable() bool
	IsString() bool
	IsNumber() bool
	IsBool() bool
	ValueAsStrings() []string
	IsIterable() bool
	Each(f func(key cty.Value, val cty.Value))
}

type Block

type Block interface {
	Attributes() map[string]Attribute
	OverrideContext(ctx *Context)
	HasModuleBlock() bool
	GetModuleBlock() (Block, error)
	Type() string
	Labels() []string
	Range() Range
	GetFirstMatchingBlock(names ...string) Block
	GetBlock(name string) Block
	AllBlocks() Blocks
	GetBlocks(name string) Blocks
	GetAttributes() []Attribute
	GetAttribute(name string) Attribute
	GetNestedAttribute(name string) Attribute
	Reference() *Reference
	LocalName() string
	FullName() string
	UniqueName() string
	TypeLabel() string
	NameLabel() string
	Clone(index cty.Value) Block
	IsCountExpanded() bool
	HasChild(childElement string) bool
	MissingChild(childElement string) bool
	MissingNestedChild(childElement string) bool
	InModule() bool
	Label() string
	HasBlock(childElement string) bool
	IsResourceType(resourceType string) bool
	IsEmpty() bool
	Values() cty.Value
	Context() *Context
	ReadLines() (lines []string, comments []string, err error)
	IsNil() bool
	IsNotNil() bool
	InjectBlock(block Block, name string)
}

func NewHCLBlock

func NewHCLBlock(hclBlock *hcl.Block, ctx *Context, moduleBlock Block) Block

type Blocks

type Blocks []Block

func (Blocks) OfType

func (blocks Blocks) OfType(t string) Blocks

type Context added in v0.58.2

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

func NewContext added in v0.58.2

func NewContext(ctx *hcl.EvalContext, parent *Context) *Context

func (*Context) Get added in v0.58.2

func (c *Context) Get(parts ...string) cty.Value

func (*Context) GetByDot added in v0.58.2

func (c *Context) GetByDot(path string) cty.Value

func (*Context) Inner added in v0.58.2

func (c *Context) Inner() *hcl.EvalContext

func (*Context) NewChild added in v0.58.2

func (c *Context) NewChild() *Context

func (*Context) Parent added in v0.58.2

func (c *Context) Parent() *Context

func (*Context) Root added in v0.58.2

func (c *Context) Root() *Context

func (*Context) Set added in v0.58.2

func (c *Context) Set(val cty.Value, parts ...string)

func (*Context) SetByDot added in v0.58.2

func (c *Context) SetByDot(val cty.Value, path string)

type EqualityOption

type EqualityOption int
const (
	IgnoreCase EqualityOption = iota
)

type HCLAttribute

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

func NewHCLAttribute

func NewHCLAttribute(attr *hcl.Attribute, ctx *Context) *HCLAttribute

func (*HCLAttribute) AllReferences added in v0.52.0

func (attr *HCLAttribute) AllReferences() []*Reference

func (*HCLAttribute) Contains

func (attr *HCLAttribute) Contains(checkValue interface{}, equalityOptions ...EqualityOption) bool

func (*HCLAttribute) Each added in v0.49.0

func (attr *HCLAttribute) Each(f func(key cty.Value, val cty.Value))

func (*HCLAttribute) EndsWith

func (attr *HCLAttribute) EndsWith(suffix interface{}) bool

func (*HCLAttribute) Equals

func (attr *HCLAttribute) Equals(checkValue interface{}, equalityOptions ...EqualityOption) bool

func (*HCLAttribute) GreaterThan

func (attr *HCLAttribute) GreaterThan(checkValue interface{}) bool

func (*HCLAttribute) GreaterThanOrEqualTo

func (attr *HCLAttribute) GreaterThanOrEqualTo(checkValue interface{}) bool

func (*HCLAttribute) HasIntersect added in v0.58.2

func (attr *HCLAttribute) HasIntersect(checkValues ...interface{}) bool

func (*HCLAttribute) IsAny

func (attr *HCLAttribute) IsAny(options ...interface{}) bool

func (*HCLAttribute) IsBool

func (attr *HCLAttribute) IsBool() bool

func (*HCLAttribute) IsDataBlockReference

func (attr *HCLAttribute) IsDataBlockReference() bool

func (*HCLAttribute) IsEmpty

func (attr *HCLAttribute) IsEmpty() bool

func (*HCLAttribute) IsFalse

func (attr *HCLAttribute) IsFalse() bool

func (*HCLAttribute) IsIterable added in v0.49.0

func (attr *HCLAttribute) IsIterable() bool

func (*HCLAttribute) IsLiteral

func (attr *HCLAttribute) IsLiteral() bool

func (*HCLAttribute) IsNil added in v0.53.0

func (attr *HCLAttribute) IsNil() bool

func (*HCLAttribute) IsNone

func (attr *HCLAttribute) IsNone(options ...interface{}) bool

func (*HCLAttribute) IsNotAny added in v0.53.1

func (attr *HCLAttribute) IsNotAny(options ...interface{}) bool

func (*HCLAttribute) IsNotNil added in v0.53.0

func (attr *HCLAttribute) IsNotNil() bool

func (*HCLAttribute) IsNotResolvable added in v0.58.2

func (attr *HCLAttribute) IsNotResolvable() bool

func (*HCLAttribute) IsNumber

func (attr *HCLAttribute) IsNumber() bool

func (*HCLAttribute) IsResolvable

func (attr *HCLAttribute) IsResolvable() bool

func (*HCLAttribute) IsResourceBlockReference

func (attr *HCLAttribute) IsResourceBlockReference(resourceType string) bool

func (*HCLAttribute) IsString

func (attr *HCLAttribute) IsString() bool

func (*HCLAttribute) IsTrue

func (attr *HCLAttribute) IsTrue() bool

func (*HCLAttribute) LessThan

func (attr *HCLAttribute) LessThan(checkValue interface{}) bool

func (*HCLAttribute) LessThanOrEqualTo

func (attr *HCLAttribute) LessThanOrEqualTo(checkValue interface{}) bool

func (*HCLAttribute) MapValue

func (attr *HCLAttribute) MapValue(mapKey string) cty.Value

func (*HCLAttribute) Name

func (attr *HCLAttribute) Name() string

func (*HCLAttribute) NotContains added in v0.54.0

func (attr *HCLAttribute) NotContains(checkValue interface{}, equalityOptions ...EqualityOption) bool

func (*HCLAttribute) NotEqual added in v0.53.0

func (attr *HCLAttribute) NotEqual(checkValue interface{}, equalityOptions ...EqualityOption) bool

func (*HCLAttribute) Range

func (attr *HCLAttribute) Range() Range

func (*HCLAttribute) Reference

func (attr *HCLAttribute) Reference() (*Reference, error)

func (*HCLAttribute) ReferencesBlock

func (attr *HCLAttribute) ReferencesBlock(b Block) bool

func (*HCLAttribute) RegexMatches

func (attr *HCLAttribute) RegexMatches(pattern interface{}) bool

func (*HCLAttribute) StartsWith

func (attr *HCLAttribute) StartsWith(prefix interface{}) bool

func (*HCLAttribute) Type

func (attr *HCLAttribute) Type() cty.Type

func (*HCLAttribute) Value

func (attr *HCLAttribute) Value() (ctyVal cty.Value)

func (*HCLAttribute) ValueAsStrings

func (attr *HCLAttribute) ValueAsStrings() []string

type HCLBlock

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

func (*HCLBlock) AllBlocks

func (b *HCLBlock) AllBlocks() Blocks

func (*HCLBlock) Attributes

func (b *HCLBlock) Attributes() map[string]Attribute

func (*HCLBlock) Clone added in v0.48.0

func (b *HCLBlock) Clone(index cty.Value) Block

func (*HCLBlock) Context added in v0.49.0

func (b *HCLBlock) Context() *Context

func (*HCLBlock) FullName

func (b *HCLBlock) FullName() string

func (*HCLBlock) GetAttribute

func (b *HCLBlock) GetAttribute(name string) Attribute

func (*HCLBlock) GetAttributes

func (b *HCLBlock) GetAttributes() []Attribute

func (*HCLBlock) GetBlock

func (b *HCLBlock) GetBlock(name string) Block

func (*HCLBlock) GetBlocks

func (b *HCLBlock) GetBlocks(name string) Blocks

func (*HCLBlock) GetFirstMatchingBlock

func (b *HCLBlock) GetFirstMatchingBlock(names ...string) Block

func (*HCLBlock) GetModuleBlock

func (b *HCLBlock) GetModuleBlock() (Block, error)

func (*HCLBlock) GetNestedAttribute

func (b *HCLBlock) GetNestedAttribute(name string) Attribute

func (*HCLBlock) HasBlock

func (b *HCLBlock) HasBlock(childElement string) bool

func (*HCLBlock) HasChild

func (b *HCLBlock) HasChild(childElement string) bool

func (*HCLBlock) HasModuleBlock

func (b *HCLBlock) HasModuleBlock() bool

func (*HCLBlock) InModule

func (b *HCLBlock) InModule() bool

func (*HCLBlock) InjectBlock added in v0.58.2

func (b *HCLBlock) InjectBlock(block Block, name string)

func (*HCLBlock) IsCountExpanded added in v0.48.5

func (b *HCLBlock) IsCountExpanded() bool

func (*HCLBlock) IsEmpty

func (b *HCLBlock) IsEmpty() bool

func (*HCLBlock) IsNil added in v0.53.0

func (b *HCLBlock) IsNil() bool

func (*HCLBlock) IsNotNil added in v0.53.0

func (b *HCLBlock) IsNotNil() bool

func (*HCLBlock) IsResourceType

func (b *HCLBlock) IsResourceType(resourceType string) bool

func (*HCLBlock) Label

func (b *HCLBlock) Label() string

func (*HCLBlock) Labels

func (b *HCLBlock) Labels() []string

func (*HCLBlock) LocalName

func (b *HCLBlock) LocalName() string

LocalName is the name relative to the current module

func (*HCLBlock) MissingChild

func (b *HCLBlock) MissingChild(childElement string) bool

func (*HCLBlock) MissingNestedChild added in v0.53.0

func (b *HCLBlock) MissingNestedChild(name string) bool

func (*HCLBlock) NameLabel

func (b *HCLBlock) NameLabel() string

func (*HCLBlock) OverrideContext added in v0.58.2

func (b *HCLBlock) OverrideContext(ctx *Context)

func (*HCLBlock) Range

func (b *HCLBlock) Range() Range

func (*HCLBlock) ReadLines added in v0.52.0

func (b *HCLBlock) ReadLines() (lines []string, comments []string, err error)

func (*HCLBlock) Reference

func (b *HCLBlock) Reference() *Reference

func (*HCLBlock) Type

func (b *HCLBlock) Type() string

func (*HCLBlock) TypeLabel

func (b *HCLBlock) TypeLabel() string

func (*HCLBlock) UniqueName added in v0.48.5

func (b *HCLBlock) UniqueName() string

func (*HCLBlock) Values

func (b *HCLBlock) Values() cty.Value

type HCLModule added in v0.58.2

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

func (*HCLModule) GetBlocks added in v0.58.2

func (c *HCLModule) GetBlocks() Blocks

func (*HCLModule) GetDatasByType added in v0.58.2

func (c *HCLModule) GetDatasByType(label string) Blocks

func (*HCLModule) GetProviderBlocksByProvider added in v0.58.2

func (c *HCLModule) GetProviderBlocksByProvider(providerName string, alias string) Blocks

func (*HCLModule) GetReferencedBlock added in v0.58.2

func (c *HCLModule) GetReferencedBlock(referringAttr Attribute) (Block, error)

func (*HCLModule) GetReferencingResources added in v0.58.2

func (c *HCLModule) GetReferencingResources(originalBlock Block, referencingLabel string, referencingAttributeName string) (Blocks, error)

func (*HCLModule) GetResourcesByType added in v0.58.2

func (c *HCLModule) GetResourcesByType(label string) Blocks

type Module added in v0.58.2

type Module interface {
	GetBlocks() Blocks
	GetResourcesByType(label string) Blocks
	GetDatasByType(label string) Blocks
	GetProviderBlocksByProvider(providerName string, alias string) Blocks
	GetReferencedBlock(referringAttr Attribute) (Block, error)
	GetReferencingResources(originalBlock Block, referencingLabel string, referencingAttributeName string) (Blocks, error)
}

func NewHCLModule added in v0.58.2

func NewHCLModule(rootPath string, modulePath string, blocks Blocks) Module

type Range

type Range struct {
	Filename  string `json:"filename"`
	StartLine int    `json:"start_line"`
	EndLine   int    `json:"end_line"`
}

Range describes an area of code, including the filename it is present in and the lin numbers the code occupies

func (Range) ReadLines added in v0.52.0

func (r Range) ReadLines(includeCommentsAfterLines bool) (lines []string, comments []string, err error)

func (Range) String

func (r Range) String() string

String creates a human-readable summary of the range

type Reference

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

func (*Reference) BlockType

func (r *Reference) BlockType() Type

func (*Reference) Key added in v0.49.0

func (r *Reference) Key() string

func (*Reference) NameLabel

func (r *Reference) NameLabel() string

func (*Reference) RefersTo

func (r *Reference) RefersTo(b Block) bool

func (*Reference) SetKey added in v0.49.0

func (r *Reference) SetKey(key cty.Value)

func (*Reference) String

func (r *Reference) String() string

func (*Reference) TypeLabel

func (r *Reference) TypeLabel() string

type Type

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

func TypeFromRefName

func TypeFromRefName(name string) (*Type, error)

func (Type) Name

func (t Type) Name() string

func (Type) ShortName

func (t Type) ShortName() string

Jump to

Keyboard shortcuts

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