Documentation ¶
Index ¶
- Variables
- func DefaultFileDecoderProvider(file string) dom.DecoderFunc
- type AddLayerOpt
- type DependencyResolutionReport
- type DependencyResolver
- type DependencyResolverBuilder
- type DocumentSet
- type FileDecoderProvider
- type ImpactAnalysis
- type ImpactAnalysisBuilder
- type OnPlaceholderEncounteredFn
- type OnResolutionFailureFn
- type PlaceholderResolutionReport
- type PlaceholderResolver
- type PlaceholderResolverBuilder
- type StringPredicateFn
Constants ¶
This section is empty.
Variables ¶
var (
ErrLayerAlreadyExists = errors.New("layer already exists")
)
Functions ¶
func DefaultFileDecoderProvider ¶
func DefaultFileDecoderProvider(file string) dom.DecoderFunc
DefaultFileDecoderProvider is FileDecoderProvider that uses file suffix to choose dom.DecoderFunc
Types ¶
type AddLayerOpt ¶
type AddLayerOpt func(*documentSet, string, *docContext)
AddLayerOpt returns function that can be used to customize document being added to set.
func MergeTags ¶ added in v1.0.33
func MergeTags() AddLayerOpt
MergeTags does not consider newly added dom.ContainerBuilder, it just merges tags into existing context
func MustCreate ¶ added in v1.0.33
func MustCreate() AddLayerOpt
MustCreate ensures that layer does not already exist
func WithTags ¶
func WithTags(tag ...string) AddLayerOpt
type DependencyResolutionReport ¶
type DependencyResolutionReport struct { // All keys that where scanned during resolution AllKeys []string // Keys of properties that were not resolved OrphanKeys []string // Mapping between any property key and coordinates Map map[string]dom.Coordinates }
DependencyResolutionReport contains result of property dependency resolution
type DependencyResolver ¶
type DependencyResolver interface { // Resolve takes each key in srcDoc and attempt to resolve its usage within srcDoc and optionally in zero or more refDoc. // On output, report will contain information about every location of inbound references // and every keys that has not been referenced at all (aka orpan keys) Resolve(srcDoc dom.OverlayDocument, refDoc ...dom.OverlayDocument) *DependencyResolutionReport }
DependencyResolver can be used to find dependency errors in document set.
func DefaultDependencyResolver ¶
func DefaultDependencyResolver() DependencyResolver
DefaultDependencyResolver returns dependency resolver with default settings
type DependencyResolverBuilder ¶
type DependencyResolverBuilder interface { // OnPlaceholderEncountered sets callback function that is invoked whenever placeholder is // encountered in property value during resolution process OnPlaceholderEncountered(func(string, dom.Coordinates)) DependencyResolverBuilder // PlaceholderMatcher overrides function that provides dom.SearchValueFunc to check for presence of placeholder in property value PlaceholderMatcher(func(string) dom.SearchValueFunc) DependencyResolverBuilder // Build creates new instance of DependencyResolver using current state of builder. // It's safe to call this method multiple times and/or call other method on this builder that mutate state of builder; // every invocation creates new, immutable instance. Build() DependencyResolver }
DependencyResolverBuilder is fluent builder interface to create DependencyResolver instance
func NewDependencyResolverBuilder ¶
func NewDependencyResolverBuilder() DependencyResolverBuilder
type DocumentSet ¶
type DocumentSet interface { // TaggedSubset creates overlay document from all documents matching at least one of given tags TaggedSubset(tag ...string) dom.OverlayDocument // NamedDocument retrieves dom.ContainerBuilder associated with given name. // If no such document exists, nil is returned. NamedDocument(name string) dom.ContainerBuilder // AsOne creates overlay document from all documents in this DocumentSet. AsOne() dom.OverlayDocument // AddDocument adds given document into documentSet. AddDocument(name string, doc dom.ContainerBuilder, opts ...AddLayerOpt) error // AddUnnamedDocument adds document that has no particular name designation, one will be generated internally AddUnnamedDocument(doc dom.ContainerBuilder, opts ...AddLayerOpt) error // AddDocumentFromFile calls AddDocumentFromFileWithDecoder with second argument set to DefaultFileDecoderProvider. AddDocumentFromFile(file string, dec dom.DecoderFunc, opts ...AddLayerOpt) error // AddDocumentFromReader reads given io.Reader using dom.DecoderFunc into document and adds it into this documentSet AddDocumentFromReader(string, io.Reader, dom.DecoderFunc, ...AddLayerOpt) error // AddPropertiesFromManifest loads string data from provided manifest as properties and adds them into this documentSet. AddPropertiesFromManifest(file string, opts ...AddLayerOpt) error // AddDocumentsFromDirectory takes provided glob pattern and loads all matching files into this documentSet. AddDocumentsFromDirectory(pattern string, decProvFn FileDecoderProvider, opts ...AddLayerOpt) error // AddDocumentsFromManifest parses K8s manifest data entries into dom.ContainerBuilder and adds them into documentSet. // See k8s package for more details about manifest support details. // Warning: invocation of this function is not atomic if error occurs mid-execution; // some manifest items might be added to DocumentSet before error occurred, while rest of them not. AddDocumentsFromManifest(manifest string, decProvFn FileDecoderProvider, opts ...AddLayerOpt) error }
DocumentSet is interface that allows to interact with multiple documents in simple way
func NewDocumentSet ¶
func NewDocumentSet() DocumentSet
NewDocumentSet creates new instance of documentSet with all fields initialized to default values.
type FileDecoderProvider ¶
type FileDecoderProvider func(file string) dom.DecoderFunc
FileDecoderProvider resolves dom.DecoderFunc for given file. If file is not recognized, nil is returned.
type ImpactAnalysis ¶ added in v1.0.37
type ImpactAnalysis interface { ResolveOverlayDocument(od dom.OverlayDocument, keys []string) map[string]dom.Coordinates ResolveDocumentSet(ds DocumentSet, keys []string) map[string]dom.Coordinates }
type ImpactAnalysisBuilder ¶ added in v1.0.37
type ImpactAnalysisBuilder interface { Build() ImpactAnalysis // WithKeyFilter allows to override default key filter predicate WithKeyFilter(StringPredicateFn) ImpactAnalysisBuilder }
func NewImpactAnalysisBuilder ¶ added in v1.0.37
func NewImpactAnalysisBuilder() ImpactAnalysisBuilder
NewImpactAnalysisBuilder returns new instance of ImpactAnalysisBuilder with default values set
type OnPlaceholderEncounteredFn ¶
type OnPlaceholderEncounteredFn func(key, ph string)
OnPlaceholderEncounteredFn is invoked when property value that contains placeholder is encountered during resolution process.
type OnResolutionFailureFn ¶
type OnResolutionFailureFn func(key, value string, coordinates dom.Coordinates)
OnResolutionFailureFn is callback function invoked when placeholder can't be resolved to actual value
type PlaceholderResolutionReport ¶
type PlaceholderResolutionReport struct { // FailedKeys is collection of all keys that failed placeholder resolution FailedKeys []string // ActualValues is mapping between keys (those that failed resolution) and their actual values // as observed during resolution process. ActualValues map[string]interface{} // Coordinates is mapping between failed keys and dom.Coordinates where placeholders are found Coordinates map[string]dom.Coordinates }
PlaceholderResolutionReport encompasses result of placeholder resolution process.
type PlaceholderResolver ¶
type PlaceholderResolver interface {
Resolve(doc dom.OverlayDocument) *PlaceholderResolutionReport
}
type PlaceholderResolverBuilder ¶
type PlaceholderResolverBuilder interface { // WithPlaceholderMatcher allows to override default predicate to match presence of placeholder in property value. // Normally you don't need to override it. WithPlaceholderMatcher(StringPredicateFn) PlaceholderResolverBuilder // WithKeyFilter allows to set filter to narrow down resolution only to keys matching provided predicate WithKeyFilter(StringPredicateFn) PlaceholderResolverBuilder OnPlaceholderEncountered(OnPlaceholderEncounteredFn) PlaceholderResolverBuilder // OnResolutionFailure sets OnResolutionFailureFn callback OnResolutionFailure(OnResolutionFailureFn) PlaceholderResolverBuilder // Build builds new PlaceholderResolver with all properties set from this builder. // It's safe to mutate state of builder and calling Build() again, it won't affect existing resolver instances. Build() PlaceholderResolver }
PlaceholderResolverBuilder is used to create instance of PlaceholderResolver
func NewPlaceholderResolverBuilder ¶
func NewPlaceholderResolverBuilder() PlaceholderResolverBuilder
type StringPredicateFn ¶
StringPredicateFn is predicate to match string value.