Documentation
¶
Overview ¶
Package cmd provides functionality to parse and evaluate HCL configuration files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Data []*Data `hcl:"data,block"`
Variables []*Variable `hcl:"variable,block"`
Environments []*Environment `hcl:"env,block"`
}
Config is the top-level struct to hold all parsed HCL blocks. It uses struct tags to map HCL blocks to Go fields.
func (*Config) Eval ¶
func (c *Config) Eval(ctx *hcl.EvalContext) (_ cty.Value, err hcl.Diagnostics)
Eval implements Node.
func (*Config) GetEnvironment ¶
func (c *Config) GetEnvironment(name string) *Environment
GetEnvironment retrieves an environment by its name from the Config.
func (*Config) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type DSQLAuthFunc ¶
type DSQLAuthFunc func(ctx context.Context, endpoint, region string, creds aws.CredentialsProvider, optFns ...func(options *auth.TokenOptions)) (string, error)
DSQLAuthFunc is a function that generates an authentication token for AWS DSQL.
type DSQLToken ¶
type DSQLToken struct {
Username hcl.Expression `hcl:"username"`
Endpoint hcl.Expression `hcl:"endpoint"`
Region hcl.Expression `hcl:"region"`
}
DSQLToken represents a token used in the configuration.
func (*DSQLToken) Eval ¶
func (x *DSQLToken) Eval(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics)
type Data ¶
type Data struct {
Type string `hcl:"type,label"`
Name string `hcl:"name,label"`
Remain hcl.Body `hcl:",remain"`
Context *hcl.EvalContext `hcl:"-"`
}
Data represents a 'data' block.
func (*Data) Eval ¶
func (x *Data) Eval(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics)
Eval evaluates the variable's default expression in the context of the provided evaluation context.
type Environment ¶
type Environment struct {
Name string `hcl:"name,label"`
Migration *Migration `hcl:"migration,block"`
URL hcl.Expression `hcl:"url"`
Context *hcl.EvalContext `hcl:"-"`
}
Environment represents an 'env' block.
func (*Environment) Eval ¶
func (x *Environment) Eval(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics)
Eval implements Node.
func (*Environment) GetURL ¶
func (x *Environment) GetURL() (string, error)
GetURL returns the URL of the environment.
type Migration ¶
type Migration struct {
Dir hcl.Expression `hcl:"dir"`
Context *hcl.EvalContext `hcl:"-"`
}
Migration represents a 'migration' block.
func (*Migration) Eval ¶
func (x *Migration) Eval(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics)
Eval implements Node.
type Node ¶
type Node interface {
// Eval evaluates the node in the context of the provided evaluation context.
Eval(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics)
}
type Variable ¶
type Variable struct {
Name string `hcl:"name,label"`
Type hcl.Expression `hcl:"type"`
Default hcl.Expression `hcl:"default,optional"`
Context *hcl.EvalContext `hcl:"-"`
}
Variable represents a 'variable' block.
func (*Variable) Eval ¶
func (x *Variable) Eval(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics)
Eval evaluates the variable's default expression in the context of the provided evaluation context.