generators

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package generators contains all codes about the Spec generator mechanism. It is a feature about kusion that can make Kusion more general in generating Spec and decoupled with KCLVM. Any generator implements the generator interface can be integrated in Kusion operation workflow.

This mechanism is very meaningful to Kusion and makes the foundation to support other languages in the feature.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendToSpec

func AppendToSpec(resourceType v1.Type, resourceID string, i *v1.Spec, resource any) error

AppendToSpec adds a Kubernetes resource to the Spec resources slice.

func CallGenerators

func CallGenerators(i *v1.Spec, newGenerators ...NewSpecGeneratorFunc) error

CallGenerators calls the Generate method of each SpecGenerator instance returned by the given NewSpecGeneratorFuncs.

func ForeachOrdered

func ForeachOrdered[T any](m map[string]T, f func(key string, value T) error) error

ForeachOrdered executes the given function on each item in the map in order of their keys.

Types

type NewSpecGeneratorFunc

type NewSpecGeneratorFunc func() (SpecGenerator, error)

NewSpecGeneratorFunc is a function that returns a SpecGenerator.

type SpecGenerator

type SpecGenerator interface {
	// Generate performs the intent generate operation.
	Generate(intent *v1.Spec) error
}

SpecGenerator is an interface for things that can generate Spec from input configurations. Note: it's for built-in generators to produce Spec, which is not the same as the general Module interface.

func CallGeneratorFuncs

func CallGeneratorFuncs(newGenerators ...NewSpecGeneratorFunc) ([]SpecGenerator, error)

CallGeneratorFuncs calls each NewSpecGeneratorFunc in the given slice and returns a slice of SpecGenerator instances.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL