Documentation ¶
Index ¶
- func RunKCL(name, source string, resourceList *yaml.RNode) (*yaml.RNode, error)
- func SourceToTempFile(source string) (string, error)
- func ToKCLValueString(value *yaml.RNode) (string, error)
- func UnwrapResources(in *yaml.RNode) ([]*yaml.RNode, *yaml.RNode, error)
- func WrapResources(nodes []*yaml.RNode, fc *yaml.RNode) (*yaml.RNode, error)
- type SimpleTransformer
- type Transformer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunKCL ¶
RunKCL runs a KCL program specified by the given source code or url, with the given resource list as input, and returns the resulting KRM resource list.
Parameters: - name: a string that represents the name of the KCL program. Not used in the function. - source: a string that represents the source code of the KCL program. - resourceList: a pointer to a yaml.RNode object that represents the input KRM resource list.
Return: A pointer to a yaml.RNode object that represents the output YAML objects of the KCL program, and an error if any.
func SourceToTempFile ¶
SourceToTempFile convert source to a temp KCL file.
func ToKCLValueString ¶
ToKCLValueString converts YAML value to KCL top level argument json value.
func UnwrapResources ¶
UnwrapResources unwraps the resources and the functionConfig from a resourceList
Types ¶
type SimpleTransformer ¶
type SimpleTransformer struct { // Name of the KCL program Name string // Source is a KCL script which will be run against the resources Source string // FunctionConfig is the functionConfig for the function. FunctionConfig *yaml.RNode }
SimpleTransformer transforms a set of resources through the provided KCL program. It doesn't touch the id annotation. It doesn't copy comments.
func (*SimpleTransformer) String ¶
func (st *SimpleTransformer) String() string
Format transformer using the name and source.