Documentation
¶
Index ¶
- Constants
- Variables
- type BlueprintFile
- type BlueprintFiles
- type BlueprintLoader
- type DefaultBlueprintLoader
- type RawBlueprint
- func (r *RawBlueprint) Decode() (schema.Blueprint, error)
- func (r RawBlueprint) DecodePath(path string, x interface{}) error
- func (r RawBlueprint) Get(path string) cue.Value
- func (r RawBlueprint) MarshalJSON() ([]byte, error)
- func (r RawBlueprint) Validate() error
- func (r RawBlueprint) Value() cue.Value
Constants ¶
const BlueprintFileName = "blueprint.cue"
Variables ¶
var (
ErrVersionNotFound = errors.New("version not found")
)
Functions ¶
This section is empty.
Types ¶
type BlueprintFile ¶
BlueprintFile represents a single blueprint file.
func NewBlueprintFile ¶
NewBlueprintFile creates a new BlueprintFile from the given CUE context, path, and contents. The contents are compiled and validated, including injecting any necessary environment variables. Additionally, the version is extracted from the CUE value. If the version is not found or invalid, or the final CUE value is invalid, an error is returned.
type BlueprintFiles ¶
type BlueprintFiles []BlueprintFile
BlueprintFiles represents a collection of blueprint files.
func (BlueprintFiles) Unify ¶
Unify unifies the blueprints into a single CUE value. If the unification fails, an error is returned.
func (BlueprintFiles) ValidateMajorVersions ¶
func (b BlueprintFiles) ValidateMajorVersions() error
validateMajors validates the major versions of the blueprints. If the blueprints have different major versions, an error is returned.
func (BlueprintFiles) Version ¶
func (b BlueprintFiles) Version() *semver.Version
Version returns the highest version number from the blueprints. If there are no blueprints, nil is returned.
type BlueprintLoader ¶
type BlueprintLoader interface { // Load loads the blueprint. Load(projectPath, gitRootPath string) (RawBlueprint, error) }
BlueprintLoader is an interface for loading blueprints.
type DefaultBlueprintLoader ¶
type DefaultBlueprintLoader struct {
// contains filtered or unexported fields
}
DefaultBlueprintLoader is the default implementation of the BlueprintLoader
func NewCustomBlueprintLoader ¶
func NewCustomBlueprintLoader( ctx *cue.Context, fs afero.Fs, logger *slog.Logger, ) DefaultBlueprintLoader
NewCustomBlueprintLoader creates a new DefaultBlueprintLoader with custom dependencies.
func NewDefaultBlueprintLoader ¶
func NewDefaultBlueprintLoader(ctx *cue.Context, logger *slog.Logger) DefaultBlueprintLoader
NewDefaultBlueprintLoader creates a new DefaultBlueprintLoader.
func (*DefaultBlueprintLoader) Load ¶
func (b *DefaultBlueprintLoader) Load(projectPath, gitRootPath string) (RawBlueprint, error)
type RawBlueprint ¶
type RawBlueprint struct {
// contains filtered or unexported fields
}
RawBlueprint represents a raw (undecoded) blueprint.
func NewRawBlueprint ¶
func NewRawBlueprint(v cue.Value) RawBlueprint
NewRawBlueprint creates a new raw blueprint.
func (*RawBlueprint) Decode ¶
func (r *RawBlueprint) Decode() (schema.Blueprint, error)
Decode decodes the raw blueprint into a schema.Blueprint.
func (RawBlueprint) DecodePath ¶
func (r RawBlueprint) DecodePath(path string, x interface{}) error
DecodePath decodes a path from the raw blueprint to the given interface.
func (RawBlueprint) Get ¶
func (r RawBlueprint) Get(path string) cue.Value
Get returns a value from the raw blueprint.
func (RawBlueprint) MarshalJSON ¶
func (r RawBlueprint) MarshalJSON() ([]byte, error)
MarshalJSON marshals the raw blueprint into JSON.
func (RawBlueprint) Validate ¶
func (r RawBlueprint) Validate() error
Validate validates the raw blueprint is valid with concrete values.
func (RawBlueprint) Value ¶
func (r RawBlueprint) Value() cue.Value
Value returns the raw blueprint value.