Documentation
¶
Index ¶
- func Instantiate(rules *InstantiationRules, cv ocm.ComponentVersionAccess, ...) error
- func Set(content *ast.File, path string, value *ast.File) error
- func Substitute(subs Substitutions, fs vfs.FileSystem) error
- func SubstituteMappings(subs ValueMappings, target subst.SubstitutionTarget) error
- func SubstituteMappingsForData(subs ValueMappings, data []byte) ([]byte, error)
- type Configuration
- type ImageMapping
- type ImageMappings
- type InstantiationRules
- type Localization
- type Substitution
- type Substitutions
- type ValueMapping
- type ValueMappings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Instantiate ¶
func Instantiate(rules *InstantiationRules, cv ocm.ComponentVersionAccess, resolver ocm.ComponentVersionResolver, config []byte, fs vfs.FileSystem, types ...string) error
func Substitute ¶
func Substitute(subs Substitutions, fs vfs.FileSystem) error
func SubstituteMappings ¶ added in v0.3.0
func SubstituteMappings(subs ValueMappings, target subst.SubstitutionTarget) error
SubstituteMappings substitutes value mappings for a dedicated substitution target.
func SubstituteMappingsForData ¶ added in v0.3.0
func SubstituteMappingsForData(subs ValueMappings, data []byte) ([]byte, error)
SubstituteMappingsForData substitutes value mappings for some data.
Types ¶
type Configuration ¶
type Configuration Substitution
Configuration is a request to substitute a configuration value. The specification describes substitution targets given by the file path and the YAML/JSON value paths of the elements in this file. The substitution value is calculated by the value expression (spiff) based on given config data. It has the same structure as Substitution, but is a request based on external configuration data, while a Substitution describes a fixed target value.
type ImageMapping ¶
type ImageMapping struct { // The optional but unique(!) name of the mapping to support referencing mapping entries Name string `json:"name,omitempty"` // The resource reference used to resolve the substitution v1.ResourceReference `json:",inline"` // Path in target to substitute by the image tag/digest Tag string `json:"tag,omitempty"` // Path in target to substitute the image repository Repository string `json:"repository,omitempty"` // Path in target to substitute the complete image Image string `json:"image,omitempty"` }
ImageMapping describes a dedicated substitution of parts of container image names based on a relative OCM resource reference.
func (*ImageMapping) Evaluate ¶ added in v0.3.0
func (m *ImageMapping) Evaluate(idx int, cv ocm.ComponentVersionAccess, resolver ocm.ComponentVersionResolver) (ValueMappings, error)
type ImageMappings ¶ added in v0.3.0
type ImageMappings []ImageMapping
type InstantiationRules ¶
type InstantiationRules struct { Template v1.ResourceReference `json:"templateResource,omitempty"` LocalizationRules []Localization `json:"localizationRules,omitempty"` ConfigRules []Configuration `json:"configRules,omitempty"` ConfigScheme json.RawMessage `json:"configScheme,omitempty"` ConfigTemplate json.RawMessage `json:"configTemplate,omitempty"` ConfigLibraries []v1.ResourceReference `json:"configLibraries,omitempty"` }
InstantiationRules bundle the localization of a filesystem resource covering image localization and applying instance configuration.
type Localization ¶
type Localization struct { // The path of the file for the substitution FilePath string `json:"file"` // The image mapping request ImageMapping `json:",inline"` }
Localization is a request to substitute an image location. The specification describes substitution targets given by the file path and the YAML/JSON value paths of the elements in this file. The substitution value is calculated from the access specification of the given resource provided by the actual component version.
type Substitution ¶
type Substitution struct { // The path of the file for the substitution FilePath string `json:"file"` // The field mapping toapply to given file path ValueMapping `json:",inline"` }
Substitution is a request to substitute the YAML/JSON element given by the value path in the given file path by the given direct value.
func (*Substitution) GetValue ¶
func (s *Substitution) GetValue() (interface{}, error)
type Substitutions ¶
type Substitutions []Substitution
func Configure ¶
func Configure( mappings []Configuration, cursubst []Substitution, cv ocm.ComponentVersionAccess, resolver ocm.ComponentVersionResolver, template []byte, config []byte, libraries []metav1.ResourceReference, schemedata []byte, ) (Substitutions, error)
func Localize ¶
func Localize(mappings []Localization, cv ocm.ComponentVersionAccess, resolver ocm.ComponentVersionResolver) (Substitutions, error)
Localize maps a list of filesystem related localization requests to an appropriate set of substitution requests.
func (*Substitutions) Add ¶
func (s *Substitutions) Add(name, file, path string, value interface{}) error
func (*Substitutions) AddValueMapping ¶ added in v0.3.0
func (s *Substitutions) AddValueMapping(m *ValueMapping, file string)
type ValueMapping ¶ added in v0.3.0
type ValueMapping struct { // The optional but unique(!) name of the mapping to support referencing mapping entries Name string `json:"name,omitempty"` // The target path for the value substitution ValuePath string `json:"path"` // The value to set Value json.RawMessage `json:"value"` }
func NewValueMapping ¶ added in v0.3.0
func NewValueMapping(name, path string, value interface{}) (*ValueMapping, error)
type ValueMappings ¶ added in v0.3.0
type ValueMappings []ValueMapping
func LocalizeMappings ¶ added in v0.3.0
func LocalizeMappings(mappings ImageMappings, cv ocm.ComponentVersionAccess, resolver ocm.ComponentVersionResolver) (ValueMappings, error)
LocalizeMappings maps a set of pure image mappings into an appropriate set of value mapping request for a single data object.
func (*ValueMappings) Add ¶ added in v0.3.0
func (s *ValueMappings) Add(name, path string, value interface{}) error