schema

package
v0.7.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	Type   string                 `json:"type"`
	Config map[string]interface{} `json:"config"`
}

type BootstrapStep added in v0.6.0

type BootstrapStep struct {
	Name     string `mapstructure:"name"`
	Type     string `mapstructure:"type"`     // secret, command, check, etc.
	Source   string `mapstructure:"source"`   // Where to fetch from (op://, sops://, etc.)
	Target   string `mapstructure:"target"`   // Where to save (file path)
	Mode     string `mapstructure:"mode"`     // File permissions (e.g., "0600")
	Command  string `mapstructure:"command"`  // For type: command
	Check    string `mapstructure:"check"`    // Command to check if step is needed
	Optional bool   `mapstructure:"optional"` // Skip if fails
}

BootstrapStep represents a single bootstrap operation

type Component

type Component struct {
	Stack                string                 `json:"stack"`
	Backend              Backend                `json:"backend"`
	Appends              map[string][]string    `json:"appends"`
	Name                 string                 `json:"name"`
	Path                 string                 `json:"path"`
	Inputs               map[string]interface{} `json:"inputs"`
	Providers            map[string]interface{} `json:"providers"`
	ProviderDependencies map[string]string      `json:"provider_dependencies,omitempty"` // component -> stack mapping for failed dependencies
}

func (*Component) EnsurePath added in v0.1.0

func (c *Component) EnsurePath(config *Config, copy bool) error

copy component to workdir if needed

func (*Component) PropertyRef added in v0.1.0

func (c *Component) PropertyRef(property string) string

property ref template to resolve later

func (*Component) ResolveVars added in v0.1.0

func (c *Component) ResolveVars(config *Config, stacks *Stacks, executor Executor) error

resolve templates in component

type Config

type Config struct {
	LogLevel        string            `mapstructure:"log_level"`
	Command         string            `mapstructure:"tf_command"`
	StacksDir       string            `mapstructure:"stacks_dir"`
	WorkDir         string            `mapstructure:"work_dir"`
	GenerateBackend bool              `mapstructure:"generate_backend"`
	Env             map[string]string `mapstructure:"env"`
	Bootstrap       []*BootstrapStep  `mapstructure:"bootstrap"`
}

type Executor added in v0.1.0

type Executor interface {
	Init(component *Component) error
	Plan(component *Component) (bool, error)
	Apply(component *Component) error
	Destroy(component *Component) error
	Output(component *Component) (map[string]*OutputMeta, error)
}

type KubeconfgCluster added in v0.3.0

type KubeconfgCluster struct {
	Context        string      `json:"context"`
	Host           string      `json:"host"`
	Cert           string      `json:"cert"`
	Token          string      `json:"token"` // Static token authentication
	ExecApiVersion string      `json:"exec_apiversion"`
	ExecCommand    string      `json:"exec_command"`
	ExecArgs       interface{} `json:"exec_args"` // Can be []string or string (template)
}

type Kubeconfig added in v0.3.0

type Kubeconfig struct {
	Current  int                 `json:"current"`
	Clusters []*KubeconfgCluster `json:"clusters"`
}

func (*Kubeconfig) Save added in v0.3.1

func (k *Kubeconfig) Save(config *Config, stacks *Stacks, executor Executor, stackName string) error

func (*Kubeconfig) Write added in v0.3.1

func (k *Kubeconfig) Write(out io.Writer, config *Config, stacks *Stacks, executor Executor, stackName string) error

type Metadata added in v0.6.2

type Metadata struct {
	Description string   `json:"description,omitempty"`
	Owner       string   `json:"owner,omitempty"`
	Tags        []string `json:"tags,omitempty"`
	Custom      any      `json:"custom,omitempty"`
}

type OutputMeta added in v0.0.2

type OutputMeta struct {
	Sensitive bool            `json:"sensitive"`
	Type      json.RawMessage `json:"type"`
	Value     json.RawMessage `json:"value"`
}

func (*OutputMeta) String added in v0.1.0

func (o *OutputMeta) String() string

type Parser added in v0.1.0

type Parser interface {
	Parse(path string) (*Stack, error)
}

type Stack

type Stack struct {
	Path       string              `json:"path"`
	Type       string              `json:"type"`
	Name       string              `json:"name"`
	Options    any                 `json:"options"`
	Metadata   *Metadata           `json:"metadata,omitempty"`
	Backend    Backend             `json:"backend"`
	Appends    map[string][]string `json:"appends"`
	Components []*Component        `json:"components"`
	Kubeconfig *Kubeconfig         `json:"kubeconfig"`
	Envs       map[string]string   `json:"envs,omitempty"` // Environment variables to set for this stack
}

func NewStack

func NewStack(path string, t string) *Stack

func (*Stack) AddComponent

func (s *Stack) AddComponent(name, path string, inputs map[string]interface{}, providers map[string]interface{}) *Component

func (*Stack) ApplyEnvs added in v0.7.0

func (s *Stack) ApplyEnvs() func()

ApplyEnvs sets the environment variables defined in this stack. Returns a cleanup function to restore the previous values.

func (*Stack) GetComponent added in v0.1.0

func (s *Stack) GetComponent(name string) (*Component, error)

func (*Stack) GetComponents added in v0.1.0

func (s *Stack) GetComponents(filterNames []string) ([]*Component, error)

func (*Stack) Valid

func (s *Stack) Valid() bool

type Stacks

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

func (*Stacks) AddStack

func (s *Stacks) AddStack(stack *Stack) error

func (*Stacks) GetStack

func (s *Stacks) GetStack(name string) (*Stack, error)

func (*Stacks) OrderByName

func (s *Stacks) OrderByName() []*Stack

type Templater added in v0.3.0

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

func NewTemplater added in v0.3.0

func NewTemplater(config *Config, stacks *Stacks, executor Executor, stackName string) (*Templater, error)

func (*Templater) Any added in v0.3.0

func (t *Templater) Any(v any, data any) error

func (*Templater) Execute added in v0.3.0

func (t *Templater) Execute(src any, dst any, data any) error

func (*Templater) Map added in v0.3.0

func (t *Templater) Map(src any, data any) (map[string]interface{}, error)

Jump to

Keyboard shortcuts

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