component

package
v0.106.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand(cfg Config) *cobra.Command

NewCommand returns the subcommand that renders individual components.

Types

type BuildPlan

type BuildPlan struct {
	holos.BuildPlan
}

type Component

type Component struct {
	// Root represents the cue module root directory.
	Root string
	// Path represents the component path relative to Root.
	Path string
}

Component implements the holos render component command.

func New

func New(root string, path string) *Component

New returns a new Component used to obtain a BuildPlan.

func (*Component) BuildPlan

func (c *Component) BuildPlan(tm holos.TypeMeta, opts holos.BuildOpts, tagMap holos.TagMap) (BuildPlan, error)

BuildPlan returns the BuildPlan for the component.

func (*Component) Render

func (c *Component) Render(ctx context.Context, writeTo string, stderr io.Writer, concurrency int, tagMap holos.TagMap) error

Render renders the component BuildPlan.

func (*Component) TypeMeta

func (c *Component) TypeMeta() (tm holos.TypeMeta, err error)

TypeMeta returns the holos.TypeMeta of the resource the component produces. Useful to discriminate behavior. If the type meta file does not exist TypeMeta returns a v1alpha5 APIVersion BuildPlan Kind.

type Config

type Config struct {
	// TagMap represents cue tags to inject.
	TagMap holos.TagMap
	// Concurrency represents the number of subcommands to execute concurrently.
	Concurrency int
	// WriteTo represents the output base directory for rendered artifacts.
	WriteTo string
	// Stderr represents the standard error output pipe.  Used to copy stderr
	// output from subcommands.
	Stderr io.Writer
}

func NewConfig

func NewConfig() Config

type Instance

type Instance struct {
	// contains filtered or unexported fields
}

Instance represents a cue instance to build. Use LoadInstance to create a new Instance.

func BuildInstance

func BuildInstance(root, leaf string, tags []string) (*Instance, error)

BuildInstance builds the cue configuration instance at leaf relative to the root cue module.

func (*Instance) Decoder

func (i *Instance) Decoder() (*json.Decoder, error)

func (*Instance) Discriminate deprecated

func (i *Instance) Discriminate(discriminate func(tm holos.TypeMeta) error) error

Discriminate calls the discriminate func for side effects. Useful to switch over the instance kind and apiVersion.

Deprecated: use loadTypeMeta() to discriminate without cue instead.

func (*Instance) Export

func (i *Instance) Export(enc holos.Encoder) error

func (*Instance) HolosValue

func (i *Instance) HolosValue() (v cue.Value, err error)

HolosValue returns the value of the holos field of the exported CUE instance.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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