Documentation
¶
Index ¶
- Constants
- type OrderedComponentMap
- type SubstitutionContext
- type Substitutor
- type Translator
- func (t *Translator) GenerateConfig(h *hpsf.HPSF, ct hpsftypes.Type, artifactVersion string, ...) (tmpl.TemplateConfig, error)
- func (t *Translator) GetComponents() map[string]config.TemplateComponent
- func (t *Translator) GetTemplates() map[string]hpsf.HPSF
- func (t *Translator) InstallComponents(components map[string]config.TemplateComponent)
- func (t *Translator) InstallTemplates(components map[string]hpsf.HPSF)
- func (t *Translator) LoadEmbeddedComponents() error
- func (t *Translator) MakeConfigComponent(component *hpsf.Component, artifactVersion string) (config.Component, error)
- func (t *Translator) ValidateConfig(h *hpsf.HPSF) error
Constants ¶
const LatestVersion = "latest"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OrderedComponentMap ¶ added in v0.6.0
type OrderedComponentMap struct {
// Keys is the list of keys in the order they were added.
Keys []string
// Values is the map of keys to values.
Values map[string]config.Component
}
OrderedComponentMap is a generic map that maintains the order of insertion. It is used to ensure that the order of components and properties is preserved when generating the configuration.
func NewOrderedComponentMap ¶ added in v0.6.0
func NewOrderedComponentMap() *OrderedComponentMap
func (*OrderedComponentMap) Get ¶ added in v0.6.0
func (om *OrderedComponentMap) Get(key string) (config.Component, bool)
Get retrieves a value from the ordered map by key.
type SubstitutionContext ¶
type Substitutor ¶
type Substitutor struct {
// contains filtered or unexported fields
}
func NewSubstitutor ¶
func NewSubstitutor() *Substitutor
func (*Substitutor) AddContext ¶
func (s *Substitutor) AddContext(name string, context SubstitutionContext, priority int)
AddContext adds an entire new context to the substitutor. The context is a map of key-value pairs that will be used for substitutions.
func (*Substitutor) AddSubstitution ¶
func (s *Substitutor) AddSubstitution(ctx, key, value string)
AddSubstitution adds a single key-value pair to a context. If the context doesn't exist, it will be created.
func (*Substitutor) DoSubstitutions ¶
func (s *Substitutor) DoSubstitutions(input string) string
func (*Substitutor) SetPriority ¶
func (s *Substitutor) SetPriority(name string, priority int)
type Translator ¶
type Translator struct {
// contains filtered or unexported fields
}
A Translator is responsible for translating an HPSF document into a collection of components, and then further rendering those into configuration files.
func NewEmptyTranslator ¶
func NewEmptyTranslator() *Translator
NewEmptyTranslator creates a translator with no components loaded.
func NewTranslator
deprecated
func NewTranslator() (*Translator, error)
Deprecated: use NewEmptyTranslator and InstallComponents instead
func (*Translator) GenerateConfig ¶
func (*Translator) GetComponents ¶ added in v0.2.0
func (t *Translator) GetComponents() map[string]config.TemplateComponent
GetComponents returns the components installed in the translator.
func (*Translator) GetTemplates ¶ added in v0.2.0
func (t *Translator) GetTemplates() map[string]hpsf.HPSF
GetTemplates returns the templates installed in the translator.
func (*Translator) InstallComponents ¶
func (t *Translator) InstallComponents(components map[string]config.TemplateComponent)
InstallComponents installs the given components into the translator.
func (*Translator) InstallTemplates ¶ added in v0.2.0
func (t *Translator) InstallTemplates(components map[string]hpsf.HPSF)
InstallTemplates installs the given templates into the translator.
func (*Translator) LoadEmbeddedComponents ¶
func (t *Translator) LoadEmbeddedComponents() error
LoadEmbeddedComponents loads the embedded components into the translator. Deprecated: use InstallComponents instead
func (*Translator) MakeConfigComponent ¶
func (*Translator) ValidateConfig ¶ added in v0.3.0
func (t *Translator) ValidateConfig(h *hpsf.HPSF) error
ValidateConfig validates the configuration of the HPSF document as it stands with respect to the components and templates installed in the translator. Note that it returns a validation.Result so that the errors can be collected and reported in a structured way. This allows for multiple validation errors to be returned at once, rather than stopping at the first error. This is useful for providing feedback to users on multiple issues in their configuration.