Documentation
¶
Overview ¶
Package renderers provides the rendering logic for computed diffs
Index ¶
- func Block(attributes map[string]computed.Diff, blocks Blocks) computed.DiffRenderer
- func List(elements []computed.Diff) computed.DiffRenderer
- func Map(elements map[string]computed.Diff) computed.DiffRenderer
- func NestedList(elements []computed.Diff) computed.DiffRenderer
- func NestedMap(elements map[string]computed.Diff) computed.DiffRenderer
- func NestedObject(attributes map[string]computed.Diff) computed.DiffRenderer
- func NestedSet(elements []computed.Diff) computed.DiffRenderer
- func Object(attributes map[string]computed.Diff) computed.DiffRenderer
- func Primitive(before, after interface{}, ctype cty.Type) computed.DiffRenderer
- func RendererJSONOpts() jsondiff.JSONOpts
- func Sensitive(change computed.Diff, beforeSensitive, afterSensitive bool) computed.DiffRenderer
- func SensitiveBlock(diff computed.Diff, beforeSensitive, afterSensitive bool) computed.DiffRenderer
- func Set(elements []computed.Diff) computed.DiffRenderer
- func TypeChange(before, after computed.Diff) computed.DiffRenderer
- func Unknown(before computed.Diff) computed.DiffRenderer
- type Blocks
- func (blocks *Blocks) AddAllListBlock(key string, diffs []computed.Diff, ...)
- func (blocks *Blocks) AddAllMapBlocks(key string, diffs map[string]computed.Diff, ...)
- func (blocks *Blocks) AddAllSetBlock(key string, diffs []computed.Diff, ...)
- func (blocks *Blocks) AddSingleBlock(key string, diff computed.Diff, replace, beforeSensitive, afterSensitive bool)
- func (blocks *Blocks) GetAllKeys() []string
- func (blocks *Blocks) IsListBlock(key string) bool
- func (blocks *Blocks) IsMapBlock(key string) bool
- func (blocks *Blocks) IsSetBlock(key string) bool
- func (blocks *Blocks) IsSingleBlock(key string) bool
- type NoWarningsRenderer
- type ValidateDiffFunction
- func ValidateBlock(attributes map[string]ValidateDiffFunction, ...) ValidateDiffFunction
- func ValidateList(elements []ValidateDiffFunction, action action.Action, replace bool) ValidateDiffFunction
- func ValidateMap(elements map[string]ValidateDiffFunction, action action.Action, replace bool) ValidateDiffFunction
- func ValidateNestedList(elements []ValidateDiffFunction, action action.Action, replace bool) ValidateDiffFunction
- func ValidateNestedObject(attributes map[string]ValidateDiffFunction, action action.Action, replace bool) ValidateDiffFunction
- func ValidateObject(attributes map[string]ValidateDiffFunction, action action.Action, replace bool) ValidateDiffFunction
- func ValidatePrimitive(before, after interface{}, action action.Action, replace bool) ValidateDiffFunction
- func ValidateSensitive(inner ValidateDiffFunction, beforeSensitive, afterSensitive bool, ...) ValidateDiffFunction
- func ValidateSet(elements []ValidateDiffFunction, action action.Action, replace bool) ValidateDiffFunction
- func ValidateTypeChange(before, after ValidateDiffFunction, action action.Action, replace bool) ValidateDiffFunction
- func ValidateUnknown(before ValidateDiffFunction, action action.Action, replace bool) ValidateDiffFunction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(elements []computed.Diff) computed.DiffRenderer
List renders a list of computed.Diffs.
func Map ¶
func Map(elements map[string]computed.Diff) computed.DiffRenderer
Map renders a map of computed.Diffs.
func NestedList ¶
func NestedList(elements []computed.Diff) computed.DiffRenderer
NestedList renders a nested list of computed.Diffs
func NestedMap ¶
func NestedMap(elements map[string]computed.Diff) computed.DiffRenderer
NestedMap renders a map of computed.Diffs
func NestedObject ¶
func NestedObject(attributes map[string]computed.Diff) computed.DiffRenderer
NestedObject renders a nested map of computed.Diffs
func NestedSet ¶
func NestedSet(elements []computed.Diff) computed.DiffRenderer
NestedSet renders a nested set of computed.Diffs
func Object ¶
func Object(attributes map[string]computed.Diff) computed.DiffRenderer
Object renders a map of computed.Diffs.
func Primitive ¶
func Primitive(before, after interface{}, ctype cty.Type) computed.DiffRenderer
Primitive is a renderer for a primitive diff
func RendererJSONOpts ¶
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
Sensitive renders a sensitive computed.Diff.
func SensitiveBlock ¶
func SensitiveBlock(diff computed.Diff, beforeSensitive, afterSensitive bool) computed.DiffRenderer
SensitiveBlock is a renderer for a sensitive block diff
func Set ¶
func Set(elements []computed.Diff) computed.DiffRenderer
Set renders a set of computed.Diffs.
func TypeChange ¶
func TypeChange(before, after computed.Diff) computed.DiffRenderer
TypeChange is a renderer for a type change diff
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)
AddAllListBlock adds a list of block diffs
func (*Blocks) AddAllMapBlocks ¶
func (blocks *Blocks) AddAllMapBlocks(key string, diffs map[string]computed.Diff, replace, beforeSensitive, afterSensitive bool)
AddAllMapBlocks adds a map of block diffs
func (*Blocks) AddAllSetBlock ¶
func (blocks *Blocks) AddAllSetBlock(key string, diffs []computed.Diff, replace, beforeSensitive, afterSensitive bool)
AddAllSetBlock adds a set of block diffs
func (*Blocks) AddSingleBlock ¶
func (blocks *Blocks) AddSingleBlock(key string, diff computed.Diff, replace, beforeSensitive, afterSensitive bool)
AddSingleBlock adds a single block
func (*Blocks) GetAllKeys ¶
GetAllKeys returns a list of keys for the blocks
func (*Blocks) IsListBlock ¶
IsListBlock returns true if the key is for a list block
func (*Blocks) IsMapBlock ¶
IsMapBlock returns true if the key is for a map block
func (*Blocks) IsSetBlock ¶
IsSetBlock returns true if the key is for a set block
func (*Blocks) IsSingleBlock ¶
IsSingleBlock returns true if the key is for a single block
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.
type ValidateDiffFunction ¶
ValidateDiffFunction is a function that validates a 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 action.Action, replace bool) ValidateDiffFunction
ValidateBlock validates a block diff
func ValidateList ¶
func ValidateList(elements []ValidateDiffFunction, action action.Action, replace bool) ValidateDiffFunction
ValidateList validates a list diff
func ValidateMap ¶
func ValidateMap(elements map[string]ValidateDiffFunction, action action.Action, replace bool) ValidateDiffFunction
ValidateMap validates a map diff
func ValidateNestedList ¶
func ValidateNestedList(elements []ValidateDiffFunction, action action.Action, replace bool) ValidateDiffFunction
ValidateNestedList validates a nested list diff
func ValidateNestedObject ¶
func ValidateNestedObject(attributes map[string]ValidateDiffFunction, action action.Action, replace bool) ValidateDiffFunction
ValidateNestedObject validates a nested object diff
func ValidateObject ¶
func ValidateObject(attributes map[string]ValidateDiffFunction, action action.Action, replace bool) ValidateDiffFunction
ValidateObject validates an object diff
func ValidatePrimitive ¶
func ValidatePrimitive(before, after interface{}, action action.Action, replace bool) ValidateDiffFunction
ValidatePrimitive validates a primitive diff
func ValidateSensitive ¶
func ValidateSensitive(inner ValidateDiffFunction, beforeSensitive, afterSensitive bool, action action.Action, replace bool) ValidateDiffFunction
ValidateSensitive validates a sensitive diff
func ValidateSet ¶
func ValidateSet(elements []ValidateDiffFunction, action action.Action, replace bool) ValidateDiffFunction
ValidateSet validates a set diff
func ValidateTypeChange ¶
func ValidateTypeChange(before, after ValidateDiffFunction, action action.Action, replace bool) ValidateDiffFunction
ValidateTypeChange validates a type change diff
func ValidateUnknown ¶
func ValidateUnknown(before ValidateDiffFunction, action action.Action, replace bool) ValidateDiffFunction
ValidateUnknown validates an unknown diff