Documentation ¶
Index ¶
- func KCLEntryOriginTmpDirCleanup(entry *KCLEntryOrigin)
- func LoadDepListFromConfig(cli *client.KpmClient, dependencies string) ([]string, error)
- func RunKCL(name, source string, resourceList *yaml.RNode) ([]*yaml.RNode, error)
- func RunKCLWithConfig(name, source string, dependencies []string, resourceList *yaml.RNode, ...) ([]*yaml.RNode, error)
- func ToKCLValueString(value *yaml.RNode, defaultValue string) (string, error)
- func UnwrapResources(nodes []*yaml.RNode) ([]*yaml.RNode, *yaml.RNode, error)
- func WrapResources(nodes []*yaml.RNode, fc *yaml.RNode) (*yaml.RNode, error)
- type KCLEntryOrigin
- type SimpleTransformer
- type Transformer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KCLEntryOriginTmpDirCleanup ¶ added in v0.10.3
func KCLEntryOriginTmpDirCleanup(entry *KCLEntryOrigin)
Remove any KCLEntryOrigin's temporary folder
func LoadDepListFromConfig ¶ added in v0.9.1
LoadDepsFrom parses the kcl external package option from a path. It will find `kcl.mod` recursively from the path, resolve deps in the `kcl.mod` and return the option. If not found, return the empty option.
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 []*yaml.RNode objects that represent the output YAML objects of the KCL program.
func RunKCLWithConfig ¶ added in v0.9.1
func RunKCLWithConfig(name, source string, dependencies []string, resourceList *yaml.RNode, config *api.ConfigSpec, getterOptions ...getter.ClientOption) ([]*yaml.RNode, error)
RunKCLWithConfig 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. - config: a pointer to a ConfigSpec that represents the compile config.
Return: A pointer to []*yaml.RNode objects that represent the output YAML objects of the KCL program.
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 KCLEntryOrigin ¶ added in v0.10.3
type KCLEntryOrigin struct {
// contains filtered or unexported fields
}
Origin of the KCL Source code to be processed
func SourceToTempEntry ¶ added in v0.9.1
func SourceToTempEntry(src string, opts ...getter.ClientOption) (*KCLEntryOrigin, error)
SourceToTempEntry convert source to a temp KCL file.
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 // Dependencies are the external dependencies for the KCL code. Dependencies []string // FunctionConfig is the functionConfig for the function. FunctionConfig *yaml.RNode // Config is the compile config. Config *api.ConfigSpec // Getter options GetterOptions []getter.ClientOption }
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.