renderers

package
v1.8.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Block

func Block(attributes map[string]computed.Diff, blocks Blocks) computed.DiffRenderer

func EnsureValidAttributeName

func EnsureValidAttributeName(name string) string

EnsureValidAttributeName checks if `name` contains any HCL syntax and calls and returns hclEscapeString.

func List

func List(elements []computed.Diff) computed.DiffRenderer

func Map

func Map(elements map[string]computed.Diff) computed.DiffRenderer

func NestedList

func NestedList(elements []computed.Diff) computed.DiffRenderer

func NestedMap

func NestedMap(elements map[string]computed.Diff) computed.DiffRenderer

func NestedObject

func NestedObject(attributes map[string]computed.Diff) computed.DiffRenderer

func NestedSet

func NestedSet(elements []computed.Diff) computed.DiffRenderer

func Object

func Object(attributes map[string]computed.Diff) computed.DiffRenderer

func Primitive

func Primitive(before, after interface{}, ctype cty.Type) computed.DiffRenderer

func RendererJsonOpts

func RendererJsonOpts() jsondiff.JsonOpts

RendererJsonOpts creates a jsondiff.JsonOpts object that returns the correct embedded renderers for each JSON type.

We need to define this in our renderers package in order to avoid cycles, and to help with reuse between the output processing in the differs package, and our JSON string rendering here.

func Sensitive

func Sensitive(change computed.Diff, beforeSensitive, afterSensitive bool) computed.DiffRenderer

func SensitiveBlock

func SensitiveBlock(diff computed.Diff, beforeSensitive, afterSensitive bool) computed.DiffRenderer

func Set

func Set(elements []computed.Diff) computed.DiffRenderer

func TypeChange

func TypeChange(before, after computed.Diff) computed.DiffRenderer

func Unknown

func Unknown(before computed.Diff) computed.DiffRenderer

Types

type Blocks

type Blocks struct {
	SingleBlocks map[string]computed.Diff
	ListBlocks   map[string][]computed.Diff
	SetBlocks    map[string][]computed.Diff
	MapBlocks    map[string]map[string]computed.Diff

	ReplaceBlocks         map[string]bool
	BeforeSensitiveBlocks map[string]bool
	AfterSensitiveBlocks  map[string]bool
}

Blocks is a helper struct for collating the different kinds of blocks in a simple way for rendering.

func (*Blocks) AddAllListBlock

func (blocks *Blocks) AddAllListBlock(key string, diffs []computed.Diff, replace, beforeSensitive, afterSensitive bool)

func (*Blocks) AddAllMapBlocks

func (blocks *Blocks) AddAllMapBlocks(key string, diffs map[string]computed.Diff, replace, beforeSensitive, afterSensitive bool)

func (*Blocks) AddAllSetBlock

func (blocks *Blocks) AddAllSetBlock(key string, diffs []computed.Diff, replace, beforeSensitive, afterSensitive bool)

func (*Blocks) AddSingleBlock

func (blocks *Blocks) AddSingleBlock(key string, diff computed.Diff, replace, beforeSensitive, afterSensitive bool)

func (*Blocks) GetAllKeys

func (blocks *Blocks) GetAllKeys() []string

func (*Blocks) IsListBlock

func (blocks *Blocks) IsListBlock(key string) bool

func (*Blocks) IsMapBlock

func (blocks *Blocks) IsMapBlock(key string) bool

func (*Blocks) IsSetBlock

func (blocks *Blocks) IsSetBlock(key string) bool

func (*Blocks) IsSingleBlock

func (blocks *Blocks) IsSingleBlock(key string) bool

type NoWarningsRenderer

type NoWarningsRenderer struct{}

NoWarningsRenderer defines a Warnings function that returns an empty list of warnings. This can be used by other renderers to ensure we don't see lots of repeats of this empty function.

func (NoWarningsRenderer) WarningsHuman

func (render NoWarningsRenderer) WarningsHuman(_ computed.Diff, _ int, _ computed.RenderHumanOpts) []string

WarningsHuman returns an empty slice, as the name NoWarningsRenderer suggests.

type ValidateDiffFunction

type ValidateDiffFunction func(t *testing.T, diff computed.Diff)

func ValidateBlock

func ValidateBlock(
	attributes map[string]ValidateDiffFunction,
	singleBlocks map[string]ValidateDiffFunction,
	listBlocks map[string][]ValidateDiffFunction,
	mapBlocks map[string]map[string]ValidateDiffFunction,
	setBlocks map[string][]ValidateDiffFunction,
	action plans.Action,
	replace bool) ValidateDiffFunction

func ValidateList

func ValidateList(elements []ValidateDiffFunction, action plans.Action, replace bool) ValidateDiffFunction

func ValidateMap

func ValidateMap(elements map[string]ValidateDiffFunction, action plans.Action, replace bool) ValidateDiffFunction

func ValidateNestedList

func ValidateNestedList(elements []ValidateDiffFunction, action plans.Action, replace bool) ValidateDiffFunction

func ValidateNestedObject

func ValidateNestedObject(attributes map[string]ValidateDiffFunction, action plans.Action, replace bool) ValidateDiffFunction

func ValidateObject

func ValidateObject(attributes map[string]ValidateDiffFunction, action plans.Action, replace bool) ValidateDiffFunction

func ValidatePrimitive

func ValidatePrimitive(before, after interface{}, action plans.Action, replace bool) ValidateDiffFunction

func ValidateSensitive

func ValidateSensitive(inner ValidateDiffFunction, beforeSensitive, afterSensitive bool, action plans.Action, replace bool) ValidateDiffFunction

func ValidateSet

func ValidateSet(elements []ValidateDiffFunction, action plans.Action, replace bool) ValidateDiffFunction

func ValidateTypeChange

func ValidateTypeChange(before, after ValidateDiffFunction, action plans.Action, replace bool) ValidateDiffFunction

func ValidateUnknown

func ValidateUnknown(before ValidateDiffFunction, action plans.Action, replace bool) ValidateDiffFunction

Jump to

Keyboard shortcuts

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