Documentation ¶
Overview ¶
Package workspace is home to primitives for loading and processing ytt artifacts including the core four steps: pre-processing schema and data values, evaluating templates, and post-processing overlays.
Index ¶
- func SortFilesInLibrary(files []*FileInLibrary)
- type DataLoader
- type DataValuesPreProcessing
- type DataValuesSchemaPreProcessing
- type DocExtractor
- type EvalExport
- type EvalResult
- type FileInLibrary
- type Library
- func (l *Library) CreateLibrary(name string) *Library
- func (l *Library) FindAccessibleLibrary(path string) (*Library, error)
- func (l *Library) FindFile(path string) (FileInLibrary, error)
- func (l *Library) FindLibrary(path string) (*Library, error)
- func (l *Library) ListAccessibleFiles() []*FileInLibrary
- func (l *Library) Print(out io.Writer)
- func (l *Library) PrintStr() string
- type LibraryExecution
- func (ll *LibraryExecution) Eval(values *datavalues.Envelope, libraryValues []*datavalues.Envelope, ...) (*EvalResult, error)
- func (ll *LibraryExecution) Schemas(overlays []*datavalues.SchemaEnvelope) (*datavalues.Schema, []*datavalues.SchemaEnvelope, error)
- func (ll *LibraryExecution) Values(valuesOverlays []*datavalues.Envelope, schema *datavalues.Schema) (*datavalues.Envelope, []*datavalues.Envelope, error)
- type LibraryExecutionContext
- type LibraryExecutionFactory
- func (f *LibraryExecutionFactory) New(ctx LibraryExecutionContext) *LibraryExecution
- func (f *LibraryExecutionFactory) ThatSkipsDataValuesValidations(skipDataValuesValidation bool) *LibraryExecutionFactory
- func (f *LibraryExecutionFactory) WithTemplateLoaderOptsOverrides(overrides TemplateLoaderOptsOverrides) *LibraryExecutionFactory
- type LibraryModule
- type OverlayPostProcessing
- type TemplateLoader
- func (l *TemplateLoader) EvalPlainYAML(file *files.File) (*yamlmeta.DocumentSet, error)
- func (l *TemplateLoader) EvalStarlark(libraryCtx LibraryExecutionContext, file *files.File) (starlark.StringDict, error)
- func (l *TemplateLoader) EvalText(libraryCtx LibraryExecutionContext, file *files.File) (starlark.StringDict, *texttemplate.NodeRoot, error)
- func (l *TemplateLoader) EvalYAML(libraryCtx LibraryExecutionContext, file *files.File) (starlark.StringDict, *yamlmeta.DocumentSet, error)
- func (l *TemplateLoader) FindCompiledTemplate(path string) *template.CompiledTemplate
- func (l *TemplateLoader) Load(thread *starlark.Thread, module string) (starlark.StringDict, error)
- type TemplateLoaderOpts
- type TemplateLoaderOptsOverrides
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SortFilesInLibrary ¶ added in v0.13.0
func SortFilesInLibrary(files []*FileInLibrary)
Types ¶
type DataLoader ¶ added in v0.48.0
type DataLoader struct {
// contains filtered or unexported fields
}
type DataValuesPreProcessing ¶ added in v0.15.0
type DataValuesPreProcessing struct {
// contains filtered or unexported fields
}
DataValuesPreProcessing combines all data values documents (and any overlays) into a result set.
func (DataValuesPreProcessing) Apply ¶ added in v0.15.0
func (pp DataValuesPreProcessing) Apply() (*datavalues.Envelope, []*datavalues.Envelope, error)
Apply executes the pre-processing of data values for all libraries.
Returns the data values for the root library and enveloped data values for children libraries.
type DataValuesSchemaPreProcessing ¶ added in v0.48.0
type DataValuesSchemaPreProcessing struct {
// contains filtered or unexported fields
}
DataValuesSchemaPreProcessing combines all data values schema documents (and any overlays) into a result set.
func (DataValuesSchemaPreProcessing) Apply ¶ added in v0.48.0
func (pp DataValuesSchemaPreProcessing) Apply() (*datavalues.Schema, []*datavalues.SchemaEnvelope, error)
Apply executes the pre-processing of schema for data values for all libraries.
Returns the schema for the root library and enveloped schema for children libraries.
type DocExtractor ¶ added in v0.48.0
type DocExtractor struct {
DocSet *yamlmeta.DocumentSet
}
func (DocExtractor) Extract ¶ added in v0.48.0
func (v DocExtractor) Extract(annName template.AnnotationName) ([]*yamlmeta.Document, []*yamlmeta.Document, error)
type EvalExport ¶ added in v0.23.0
type EvalExport struct { Path string Symbols starlark.StringDict }
type EvalResult ¶ added in v0.15.0
type EvalResult struct { Files []files.OutputFile DocSet *yamlmeta.DocumentSet Exports []EvalExport }
type FileInLibrary ¶ added in v0.5.0
type FileInLibrary struct { File *files.File Library *Library // contains filtered or unexported fields }
func (*FileInLibrary) RelativePath ¶ added in v0.15.0
func (fileInLib *FileInLibrary) RelativePath() string
type Library ¶
type Library struct {
// contains filtered or unexported fields
}
func NewRootLibrary ¶
func (*Library) CreateLibrary ¶
func (*Library) FindAccessibleLibrary ¶
func (*Library) ListAccessibleFiles ¶
func (l *Library) ListAccessibleFiles() []*FileInLibrary
type LibraryExecution ¶ added in v0.48.0
type LibraryExecution struct {
// contains filtered or unexported fields
}
LibraryExecution is the total set of configuration and dependencies that are used to accomplish the execution of a Library.
func NewLibraryExecution ¶ added in v0.48.0
func NewLibraryExecution(libraryCtx LibraryExecutionContext, ui ui.UI, templateLoaderOpts TemplateLoaderOpts, libraryExecFactory *LibraryExecutionFactory, skipDataValuesValidation bool) *LibraryExecution
NewLibraryExecution configures a new instance of a LibraryExecution.
func (*LibraryExecution) Eval ¶ added in v0.48.0
func (ll *LibraryExecution) Eval(values *datavalues.Envelope, libraryValues []*datavalues.Envelope, librarySchemas []*datavalues.SchemaEnvelope) (*EvalResult, error)
Eval given the final data values (as the parameter values) runs this LibraryExecution, evaluating all templates in this library and then applying overlays over that result.
Returns the final set of Documents and output files. Returns an error if any template fails to evaluate, any overlay fails to apply, or if one or more "Envelopes" were not delivered/used.
func (*LibraryExecution) Schemas ¶ added in v0.48.0
func (ll *LibraryExecution) Schemas(overlays []*datavalues.SchemaEnvelope) (*datavalues.Schema, []*datavalues.SchemaEnvelope, error)
Schemas calculates the final schema for the Data Values in this library by combining/overlaying the schema file(s) in the library and the passed-in overlays.
Returns this library's Schema and a slice of Schema intended for child libraries.
func (*LibraryExecution) Values ¶ added in v0.48.0
func (ll *LibraryExecution) Values(valuesOverlays []*datavalues.Envelope, schema *datavalues.Schema) (*datavalues.Envelope, []*datavalues.Envelope, error)
Values calculates the final Data Values for this library by combining/overlaying defaults from the schema, the Data Values file(s) in the library, and the passed-in Data Values overlays. The final Data Values are validated using the validations annotated on a Data Value.
Returns this library's Data Values and a collection of Data Values addressed to child libraries. Returns an error if the overlay operation fails or the result over an overlay fails a schema check.
type LibraryExecutionContext ¶ added in v0.24.0
type LibraryExecutionContext struct { Current *Library // the target library that will be executed/evaluated. Root *Library // reference to the root library to support accessing "absolute path" loading of files. }
LibraryExecutionContext holds the total set of inputs that are involved in a LibraryExecution.
type LibraryExecutionFactory ¶ added in v0.23.0
type LibraryExecutionFactory struct {
// contains filtered or unexported fields
}
LibraryExecutionFactory holds configuration for and produces instances of LibraryExecution's.
func NewLibraryExecutionFactory ¶ added in v0.23.0
func NewLibraryExecutionFactory(ui ui.UI, templateLoaderOpts TemplateLoaderOpts, skipDataValuesValidation bool) *LibraryExecutionFactory
NewLibraryExecutionFactory configures a new instance of a LibraryExecutionFactory.
func (*LibraryExecutionFactory) New ¶ added in v0.23.0
func (f *LibraryExecutionFactory) New(ctx LibraryExecutionContext) *LibraryExecution
New produces a new instance of a LibraryExecution, set with the configuration and dependencies of this factory.
func (*LibraryExecutionFactory) ThatSkipsDataValuesValidations ¶ added in v0.48.0
func (f *LibraryExecutionFactory) ThatSkipsDataValuesValidations(skipDataValuesValidation bool) *LibraryExecutionFactory
ThatSkipsDataValuesValidations produces a new LibraryExecutionFactory identical to this one, except it might also skip running validation rules over Data Values.
If a LibraryExecutionFactory has already been configured to skip validations, calling this method with `true` has no effect. This stems from the assumption that the downstream user is the most informed whether validations ought to be run.
func (*LibraryExecutionFactory) WithTemplateLoaderOptsOverrides ¶ added in v0.48.0
func (f *LibraryExecutionFactory) WithTemplateLoaderOptsOverrides(overrides TemplateLoaderOptsOverrides) *LibraryExecutionFactory
WithTemplateLoaderOptsOverrides produces a new LibraryExecutionFactory identical to this one, except it configures its TemplateLoader with the merge of the supplied TemplateLoaderOpts over this factory's configuration.
type LibraryModule ¶ added in v0.23.0
type LibraryModule struct {
// contains filtered or unexported fields
}
LibraryModule is the definition of the ytt-supplied Starlark module `@ytt:library`
This module produces library instances (see Get()). The configuration is copied from the library execution to the new instance of a library module (see NewLibraryModule())
func NewLibraryModule ¶ added in v0.23.0
func NewLibraryModule(libraryCtx LibraryExecutionContext, libraryExecutionFactory *LibraryExecutionFactory, libraryValues []*datavalues.Envelope, librarySchemas []*datavalues.SchemaEnvelope) LibraryModule
func (LibraryModule) AsModule ¶ added in v0.23.0
func (b LibraryModule) AsModule() starlark.StringDict
AsModule defines the contents of the "@ytt:library" module. Produces an instance of the "@ytt:library" module suitable to be consumed by starlark.Thread.Load()
func (LibraryModule) Get ¶ added in v0.23.0
func (b LibraryModule) Get(thread *starlark.Thread, f *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
Get is a starlark.Builtin that, given the path to a private library, returns an instance of it as a libraryValue.
type OverlayPostProcessing ¶ added in v0.15.0
type OverlayPostProcessing struct {
// contains filtered or unexported fields
}
func (OverlayPostProcessing) Apply ¶ added in v0.15.0
func (o OverlayPostProcessing) Apply() (map[*FileInLibrary]*yamlmeta.DocumentSet, error)
type TemplateLoader ¶
type TemplateLoader struct {
// contains filtered or unexported fields
}
func NewTemplateLoader ¶
func NewTemplateLoader(values *datavalues.Envelope, libraryValuess []*datavalues.Envelope, librarySchemas []*datavalues.SchemaEnvelope, opts TemplateLoaderOpts, libraryExecFactory *LibraryExecutionFactory, ui ui.UI) *TemplateLoader
NewTemplateLoader instantiates a new TemplateLoader.
func (*TemplateLoader) EvalPlainYAML ¶ added in v0.48.0
func (l *TemplateLoader) EvalPlainYAML(file *files.File) (*yamlmeta.DocumentSet, error)
func (*TemplateLoader) EvalStarlark ¶
func (l *TemplateLoader) EvalStarlark(libraryCtx LibraryExecutionContext, file *files.File) (starlark.StringDict, error)
func (*TemplateLoader) EvalText ¶
func (l *TemplateLoader) EvalText(libraryCtx LibraryExecutionContext, file *files.File) (starlark.StringDict, *texttemplate.NodeRoot, error)
func (*TemplateLoader) EvalYAML ¶
func (l *TemplateLoader) EvalYAML(libraryCtx LibraryExecutionContext, file *files.File) (starlark.StringDict, *yamlmeta.DocumentSet, error)
EvalYAML parses the file into a Node AST, then compiles that Node tree into a starlark program.
Returns the templated file by evaluating the compiled starlark program.
func (*TemplateLoader) FindCompiledTemplate ¶
func (l *TemplateLoader) FindCompiledTemplate(path string) *template.CompiledTemplate
FindCompiledTemplate returns the template.CompiledTemplate that was produced from the file at "path".
If no such template exists, returns nil.
func (*TemplateLoader) Load ¶
func (l *TemplateLoader) Load(thread *starlark.Thread, module string) (starlark.StringDict, error)
type TemplateLoaderOpts ¶ added in v0.12.0
type TemplateLoaderOpts struct { IgnoreUnknownComments bool ImplicitMapKeyOverrides bool StrictYAML bool }
TemplateLoaderOpts holds configuration options that adjust how each individual template is executed/evaluated.
func (TemplateLoaderOpts) Merge ¶ added in v0.48.0
func (opts TemplateLoaderOpts) Merge(overrides TemplateLoaderOptsOverrides) TemplateLoaderOpts
type TemplateLoaderOptsOverrides ¶ added in v0.48.0
type TemplateLoaderOptsOverrides struct { IgnoreUnknownComments *bool ImplicitMapKeyOverrides *bool StrictYAML *bool }
TemplateLoaderOptsOverrides hold potential overriding values to be merged over a TemplateLoaderOpts. Only non-null values are merged.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package datavalues integrates the schema and data values features into the workspace, providing a means of "addressing" to specific libraries.
|
Package datavalues integrates the schema and data values features into the workspace, providing a means of "addressing" to specific libraries. |
Package ref provides the general-purpose ability to mark a document as targeted for specific library.
|
Package ref provides the general-purpose ability to mark a document as targeted for specific library. |