Documentation
¶
Overview ¶
Package templatecatalog reads and validates Galaxio template registries and packs.
Index ¶
- Constants
- Variables
- func CacheDir() (string, error)
- func ClearCache() (string, error)
- func ValidatePack(pack Pack) error
- func ValidateRegistry(registry Registry) error
- func ValidateTemplate(template Template) error
- type Pack
- type PackTemplate
- type Registry
- type RegistryPack
- type RenderOptions
- type RenderResult
- type SourceError
- type SourceFetcher
- func (f SourceFetcher) FindTemplate(ctx context.Context, registrySource string, name string) (TemplateRef, error)
- func (f SourceFetcher) ListTemplates(ctx context.Context, registrySource string) ([]TemplateRef, error)
- func (f SourceFetcher) LoadPack(ctx context.Context, source string) (Pack, error)
- func (f SourceFetcher) LoadRegistry(ctx context.Context, source string) (Registry, error)
- func (f SourceFetcher) LoadTemplate(ctx context.Context, packSource string, templatePath string) (Template, error)
- func (f SourceFetcher) Render(ctx context.Context, opts RenderOptions) (RenderResult, error)
- func (f SourceFetcher) ValidateSource(ctx context.Context, source string) error
- type Template
- type TemplateFile
- type TemplateInput
- type TemplateRef
Constants ¶
const (
DefaultRegistrySource = "github:galax-io/galaxio-template-registry"
)
Variables ¶
var ErrTemplateNotFound = errors.New("template not found")
ErrTemplateNotFound is returned when a registry does not contain a requested template reference.
Functions ¶
func ClearCache ¶ added in v0.4.0
func ValidatePack ¶
ValidatePack validates pack-level invariants.
func ValidateRegistry ¶
ValidateRegistry validates registry-level invariants.
func ValidateTemplate ¶
ValidateTemplate validates template-level invariants.
Types ¶
type Pack ¶
type Pack struct {
APIVersion string `yaml:"apiVersion"`
Kind string `yaml:"kind"`
Name string `yaml:"name"`
Version string `yaml:"version"`
Description string `yaml:"description"`
Templates []PackTemplate `yaml:"templates"`
}
Pack describes templates available in one template pack repository.
type PackTemplate ¶
type PackTemplate struct {
Name string `yaml:"name"`
Version string `yaml:"version"`
Path string `yaml:"path"`
Description string `yaml:"description"`
}
PackTemplate points to one template manifest inside a pack.
type Registry ¶
type Registry struct {
APIVersion string `yaml:"apiVersion"`
Kind string `yaml:"kind"`
Packs []RegistryPack `yaml:"packs"`
}
Registry is the root index of available template packs.
type RegistryPack ¶
type RegistryPack struct {
Name string `yaml:"name"`
Source string `yaml:"source"`
Description string `yaml:"description"`
}
RegistryPack describes one template pack source.
type RenderOptions ¶ added in v0.4.0
type RenderOptions struct {
RegistrySource string
TemplateName string
Destination string
Values map[string]string
}
RenderOptions configures template rendering.
type RenderResult ¶ added in v0.4.0
type RenderResult struct {
Template string `json:"template"`
Version string `json:"version,omitempty"`
PackVersion string `json:"packVersion"`
Source string `json:"source"`
Destination string `json:"destination"`
Files int `json:"files"`
Status string `json:"status"`
}
RenderResult describes rendered template output.
type SourceError ¶ added in v0.3.1
SourceError adds user-facing context to source loading failures.
func (SourceError) Error ¶ added in v0.3.1
func (e SourceError) Error() string
func (SourceError) Unwrap ¶ added in v0.3.1
func (e SourceError) Unwrap() error
type SourceFetcher ¶
SourceFetcher loads manifest files from local paths or remote sources.
func (SourceFetcher) FindTemplate ¶ added in v0.3.1
func (f SourceFetcher) FindTemplate(ctx context.Context, registrySource string, name string) (TemplateRef, error)
FindTemplate resolves a template reference from a registry.
func (SourceFetcher) ListTemplates ¶ added in v0.3.1
func (f SourceFetcher) ListTemplates(ctx context.Context, registrySource string) ([]TemplateRef, error)
ListTemplates reads the registry and resolves templates from referenced packs.
func (SourceFetcher) LoadRegistry ¶
LoadRegistry loads and validates a registry manifest from source.
func (SourceFetcher) LoadTemplate ¶
func (f SourceFetcher) LoadTemplate(ctx context.Context, packSource string, templatePath string) (Template, error)
LoadTemplate loads and validates a template manifest from a pack source.
func (SourceFetcher) Render ¶ added in v0.4.0
func (f SourceFetcher) Render(ctx context.Context, opts RenderOptions) (RenderResult, error)
Render resolves a template from a registry and renders it into a destination.
func (SourceFetcher) ValidateSource ¶
func (f SourceFetcher) ValidateSource(ctx context.Context, source string) error
ValidateSource validates a template pack source and its template manifests.
type Template ¶
type Template struct {
APIVersion string `yaml:"apiVersion"`
Kind string `yaml:"kind"`
Name string `yaml:"name"`
DisplayName string `yaml:"displayName"`
Description string `yaml:"description"`
Engine string `yaml:"engine"`
Tags []string `yaml:"tags"`
Inputs map[string]TemplateInput `yaml:"inputs"`
Computed map[string]string `yaml:"computed"`
Files []TemplateFile `yaml:"files"`
}
Template describes one renderable template.
type TemplateFile ¶
TemplateFile describes one file mapping in a template.
type TemplateInput ¶ added in v0.4.0
type TemplateInput struct {
Type string `yaml:"type"`
Default any `yaml:"default"`
Description string `yaml:"description"`
}
TemplateInput describes one configurable template input.
type TemplateRef ¶
type TemplateRef struct {
Name string `json:"name"`
Pack string `json:"pack"`
PackVersion string `json:"packVersion"`
Version string `json:"version,omitempty"`
Path string `json:"-"`
Source string `json:"source"`
Description string `json:"description,omitempty"`
Templates int `json:"templates"`
Placeholder bool `json:"placeholder"`
}
TemplateRef is a resolved template available to users.