package blueprint

import "github.com/input-output-hk/catalyst-forge/lib/blueprint/pkg/blueprint"

Index

Types

type BlueprintFile

type BlueprintFile struct {
	Path    string
	Value   cue.Value
	Version *semver.Version
}

BlueprintFile represents a single blueprint file.

func NewBlueprintFile

func NewBlueprintFile(ctx *cue.Context, path string, contents []byte, inj injector.Injector) (BlueprintFile, error)

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

func (b BlueprintFiles) Unify(ctx *cue.Context) (cue.Value, error)

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 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) Value

func (r RawBlueprint) Value() cue.Value

Value returns the raw blueprint value.

Source Files

blueprint.go raw.go

Version
v0.0.0-20240928203643-c3373f0052b9 (latest)
Published
Sep 28, 2024
Platform
linux/amd64
Imports
8 packages
Last checked
2 days ago

Tools for package owners.