Documentation
¶
Index ¶
- Constants
- Variables
- func GetPropertyFunc(ps *PropertySource) func(string) any
- func GetTypedProperty[T any](source *PropertySource, key string) (T, bool)
- type Binding
- func (b *Binding) DeclareOutput(key string, declaration OutputDeclaration)
- func (b *Binding) GetEdges() []*Edge
- func (b *Binding) GetInitialGraph() construct.Graph
- func (b *Binding) GetInput(name string) (val any, ok bool)
- func (b *Binding) GetInputRules() []InputRuleTemplate
- func (b *Binding) GetPropertySource() *PropertySource
- func (b *Binding) GetResource(resourceId string) (resource *Resource, ok bool)
- func (b *Binding) GetResources() map[string]*Resource
- func (b *Binding) GetTemplateEdges() []EdgeTemplate
- func (b *Binding) GetTemplateInputs() map[string]InputTemplate
- func (b *Binding) GetTemplateOutputs() map[string]OutputTemplate
- func (b *Binding) GetTemplateResourcesIterator() Iterator[string, ResourceTemplate]
- func (b *Binding) GetURN() model.URN
- func (b *Binding) SetEdges(edges []*Edge)
- func (b *Binding) SetResource(resourceId string, resource *Resource)
- func (b *Binding) String() string
- type BindingDeclaration
- type BindingDirection
- type BindingTemplate
- type ConditionalExpressionTemplate
- type Construct
- func (c *Construct) DeclareOutput(key string, declaration OutputDeclaration)
- func (c *Construct) GetEdges() []*Edge
- func (c *Construct) GetInitialGraph() construct.Graph
- func (c *Construct) GetInput(name string) (value any, ok bool)
- func (c *Construct) GetInputRules() []InputRuleTemplate
- func (c *Construct) GetPropertySource() *PropertySource
- func (c *Construct) GetResource(resourceId string) (resource *Resource, ok bool)
- func (c *Construct) GetResources() map[string]*Resource
- func (c *Construct) GetTemplateEdges() []EdgeTemplate
- func (c *Construct) GetTemplateInputs() map[string]InputTemplate
- func (c *Construct) GetTemplateOutputs() map[string]OutputTemplate
- func (c *Construct) GetTemplateResourcesIterator() Iterator[string, ResourceTemplate]
- func (c *Construct) GetURN() model.URN
- func (c *Construct) OrderedBindings() []*Binding
- func (c *Construct) SetEdges(edges []*Edge)
- func (c *Construct) SetResource(resourceId string, resource *Resource)
- type ConstructEvaluator
- func (ce *ConstructEvaluator) AddSolution(urn model.URN, sol solution.Solution)
- func (ce *ConstructEvaluator) Evaluate(constructUrn model.URN, state model.State, ctx context.Context) (engine.SolveRequest, error)
- func (ce *ConstructEvaluator) RegisterOutputValues(urn model.URN, outputs map[string]any)
- func (ce *ConstructEvaluator) ResolveInput(k string, v model.Input, t InputTemplate) (any, error)
- type ConstructMarshaller
- type ConstructTemplate
- type ConstructTemplateId
- type Edge
- type EdgeOwner
- type EdgeTemplate
- type InfraOwner
- type InputRuleTemplate
- type InputTemplate
- type InterpolationContext
- type InterpolationSource
- type InterpolationSourceKey
- type IterFunc
- type Iterator
- type OutputDeclaration
- type OutputTemplate
- type PropertySource
- type Resource
- type ResourceOwner
- type ResourceRef
- type ResourceRefType
- type ResourceTemplate
- type TemplateFuncSupplier
- type ValidationTemplate
Constants ¶
const ( BindingDirectionFrom = "from" BindingDirectionTo = "to" )
Variables ¶
var ( ResourceInterpolationContext = []InterpolationSourceKey{InputsInterpolation, ResourcesInterpolation, ResourcesInterpolation} EdgeInterpolationContext = []InterpolationSourceKey{InputsInterpolation, ResourcesInterpolation, EdgesInterpolation} OutputInterpolationContext = []InterpolationSourceKey{InputsInterpolation, ResourcesInterpolation, EdgesInterpolation, MetaInterpolation} InputRuleInterpolationContext = []InterpolationSourceKey{InputsInterpolation, ResourcesInterpolation, EdgesInterpolation, MetaInterpolation} BindingInterpolationContext = []InterpolationSourceKey{InputsInterpolation, ResourcesInterpolation, EdgesInterpolation, MetaInterpolation, FromInterpolation, ToInterpolation} )
Functions ¶
func GetPropertyFunc ¶
func GetPropertyFunc(ps *PropertySource) func(string) any
func GetTypedProperty ¶
func GetTypedProperty[T any](source *PropertySource, key string) (T, bool)
Types ¶
type Binding ¶
type Binding struct {
Owner *Construct
From *Construct
To *Construct
Priority int
BindingTemplate BindingTemplate
Meta map[string]any
Inputs construct.Properties
Resources map[string]*Resource
Edges []*Edge
OutputDeclarations map[string]OutputDeclaration
Outputs map[string]any
InitialGraph construct.Graph
}
func (*Binding) DeclareOutput ¶
func (b *Binding) DeclareOutput(key string, declaration OutputDeclaration)
func (*Binding) GetInitialGraph ¶
func (*Binding) GetInputRules ¶
func (b *Binding) GetInputRules() []InputRuleTemplate
func (*Binding) GetPropertySource ¶
func (b *Binding) GetPropertySource() *PropertySource
func (*Binding) GetResource ¶
func (*Binding) GetResources ¶
func (*Binding) GetTemplateEdges ¶
func (b *Binding) GetTemplateEdges() []EdgeTemplate
func (*Binding) GetTemplateInputs ¶
func (b *Binding) GetTemplateInputs() map[string]InputTemplate
func (*Binding) GetTemplateOutputs ¶
func (b *Binding) GetTemplateOutputs() map[string]OutputTemplate
func (*Binding) GetTemplateResourcesIterator ¶
func (b *Binding) GetTemplateResourcesIterator() Iterator[string, ResourceTemplate]
func (*Binding) SetResource ¶
type BindingDeclaration ¶
type BindingDirection ¶
type BindingDirection string
type BindingTemplate ¶
type BindingTemplate struct {
From ConstructTemplateId `yaml:"from"`
To ConstructTemplateId `yaml:"to"`
Priority int `yaml:"priority"`
Inputs map[string]InputTemplate `yaml:"inputs"`
Outputs map[string]OutputTemplate `yaml:"outputs"`
InputRules []InputRuleTemplate `yaml:"input_rules"`
Resources map[string]ResourceTemplate `yaml:"resources"`
Edges []EdgeTemplate `yaml:"edges"`
// contains filtered or unexported fields
}
func (*BindingTemplate) ResourcesIterator ¶
func (b *BindingTemplate) ResourcesIterator() Iterator[string, ResourceTemplate]
func (*BindingTemplate) UnmarshalYAML ¶
func (b *BindingTemplate) UnmarshalYAML(value *yaml.Node) error
type ConditionalExpressionTemplate ¶
type ConditionalExpressionTemplate struct {
Resources map[string]ResourceTemplate `yaml:"resources"`
Edges []EdgeTemplate `yaml:"edges"`
Outputs map[string]OutputTemplate `yaml:"outputs"`
}
type Construct ¶
type Construct struct {
URN model.URN
ConstructTemplate ConstructTemplate
Meta map[string]any
Inputs map[string]any
Resources map[string]*Resource
Edges []*Edge
OutputDeclarations map[string]OutputDeclaration
Outputs map[string]any
InitialGraph construct.Graph
Bindings []*Binding
Solution solution.Solution
}
func NewConstruct ¶
NewConstruct creates a new Construct instance from the given URN and inputs. The URN must be a construct URN. Any inputs that are not provided will be populated with default values from the construct template.
func (*Construct) DeclareOutput ¶
func (c *Construct) DeclareOutput(key string, declaration OutputDeclaration)
func (*Construct) GetInitialGraph ¶
func (*Construct) GetInputRules ¶
func (c *Construct) GetInputRules() []InputRuleTemplate
func (*Construct) GetPropertySource ¶
func (c *Construct) GetPropertySource() *PropertySource
func (*Construct) GetResource ¶
func (*Construct) GetResources ¶
func (*Construct) GetTemplateEdges ¶
func (c *Construct) GetTemplateEdges() []EdgeTemplate
func (*Construct) GetTemplateInputs ¶
func (c *Construct) GetTemplateInputs() map[string]InputTemplate
func (*Construct) GetTemplateOutputs ¶
func (c *Construct) GetTemplateOutputs() map[string]OutputTemplate
func (*Construct) GetTemplateResourcesIterator ¶
func (c *Construct) GetTemplateResourcesIterator() Iterator[string, ResourceTemplate]
func (*Construct) OrderedBindings ¶
OrderedBindings returns the bindings sorted by priority (lowest to highest). If two bindings have the same priority, their declaration order is preserved.
func (*Construct) SetResource ¶
type ConstructEvaluator ¶
type ConstructEvaluator struct {
DryRun model.DryRun
Constructs async.ConcurrentMap[model.URN, *Construct]
// contains filtered or unexported fields
}
func NewConstructEvaluator ¶
func NewConstructEvaluator(sm *model.StateManager, ssm *stack.StateManager) (*ConstructEvaluator, error)
func (*ConstructEvaluator) AddSolution ¶
func (ce *ConstructEvaluator) AddSolution(urn model.URN, sol solution.Solution)
func (*ConstructEvaluator) Evaluate ¶
func (ce *ConstructEvaluator) Evaluate(constructUrn model.URN, state model.State, ctx context.Context) (engine.SolveRequest, error)
func (*ConstructEvaluator) RegisterOutputValues ¶
func (ce *ConstructEvaluator) RegisterOutputValues(urn model.URN, outputs map[string]any)
func (*ConstructEvaluator) ResolveInput ¶
func (ce *ConstructEvaluator) ResolveInput(k string, v model.Input, t InputTemplate) (any, error)
ResolveInput converts a model.Input to a construct.Input and adds it to the inputs map. If the value of the input is a URN, it resolves the URN to a construct. If the input's status is not "resolved", it returns an error.
type ConstructMarshaller ¶
type ConstructMarshaller struct {
ConstructEvaluator *ConstructEvaluator
}
ConstructMarshaller is a struct that marshals a Construct into a list of constraints
func (*ConstructMarshaller) Marshal ¶
func (m *ConstructMarshaller) Marshal(constructURN model.URN) (constraints.ConstraintList, error)
Marshal marshals a Construct into a list of constraints
type ConstructTemplate ¶
type ConstructTemplate struct {
Id ConstructTemplateId `yaml:"id"`
Version string `yaml:"version"`
Description string `yaml:"description"`
Resources map[string]ResourceTemplate `yaml:"resources"`
Edges []EdgeTemplate `yaml:"edges"`
Inputs map[string]InputTemplate `yaml:"inputs"`
Outputs map[string]OutputTemplate `yaml:"outputs"`
InputRules []InputRuleTemplate `yaml:"input_rules"`
// contains filtered or unexported fields
}
func (*ConstructTemplate) GetBindingTemplate ¶
func (c *ConstructTemplate) GetBindingTemplate(direction BindingDirection, other ConstructTemplateId) (BindingTemplate, error)
func (*ConstructTemplate) ResourcesIterator ¶
func (c *ConstructTemplate) ResourcesIterator() Iterator[string, ResourceTemplate]
func (*ConstructTemplate) UnmarshalYAML ¶
func (c *ConstructTemplate) UnmarshalYAML(value *yaml.Node) error
type ConstructTemplateId ¶
func ParseConstructTemplateId ¶
func ParseConstructTemplateId(id string) (ConstructTemplateId, error)
func (*ConstructTemplateId) String ¶
func (c *ConstructTemplateId) String() string
func (*ConstructTemplateId) UnmarshalYAML ¶
func (c *ConstructTemplateId) UnmarshalYAML(value *yaml.Node) error
type Edge ¶
type Edge struct {
From ResourceRef
To ResourceRef
Data construct.EdgeData
}
func (*Edge) PrettyPrint ¶
type EdgeOwner ¶
type EdgeOwner interface {
GetTemplateEdges() []EdgeTemplate
GetEdges() []*Edge
SetEdges(edges []*Edge)
InterpolationSource
}
type EdgeTemplate ¶
type EdgeTemplate struct {
From ResourceRef `yaml:"from"`
To ResourceRef `yaml:"to"`
Data construct.EdgeData `yaml:"data"`
}
func (*EdgeTemplate) UnmarshalYAML ¶
func (e *EdgeTemplate) UnmarshalYAML(value *yaml.Node) error
type InfraOwner ¶
type InfraOwner interface {
GetURN() model.URN
GetInputRules() []InputRuleTemplate
ResourceOwner
EdgeOwner
GetTemplateOutputs() map[string]OutputTemplate
DeclareOutput(key string, declaration OutputDeclaration)
GetTemplateInputs() map[string]InputTemplate
GetInput(name string) (value any, ok bool)
GetInitialGraph() construct.Graph
}
type InputRuleTemplate ¶
type InputRuleTemplate struct {
If string `yaml:"if"`
Then ConditionalExpressionTemplate `yaml:"then"`
Else ConditionalExpressionTemplate `yaml:"else"`
}
type InputTemplate ¶
type InputTemplate struct {
Name string `yaml:"name"`
Type string `yaml:"type"`
Description string `yaml:"description"`
Default any `yaml:"default"`
Secret bool `yaml:"secret"`
PulumiKey string `yaml:"pulumi_key"`
Validation ValidationTemplate `yaml:"validation"`
Configuration map[string]any `yaml:"configuration"`
}
type InterpolationContext ¶
type InterpolationContext struct {
AllowedKeys []InterpolationSourceKey
Construct *Construct
}
func NewInterpolationContext ¶
func NewInterpolationContext(c *Construct, keys []InterpolationSourceKey) InterpolationContext
type InterpolationSource ¶
type InterpolationSource interface {
GetPropertySource() *PropertySource
}
type InterpolationSourceKey ¶
type InterpolationSourceKey string
const ( // InputsInterpolation is an interpolation source used to interpolate values from the construct's inputs InputsInterpolation InterpolationSourceKey = "inputs" // ResourcesInterpolation is an interpolation source used to interpolate values from the construct's resources ResourcesInterpolation InterpolationSourceKey = "resources" // EdgesInterpolation is an interpolation source used to interpolate values from the construct's edges EdgesInterpolation InterpolationSourceKey = "edges" // MetaInterpolation is an interpolation source used to interpolate values from the construct's metadata // (i.e., non-properties fields) MetaInterpolation InterpolationSourceKey = "meta" // BindingInterpolation is an interpolation source used to interpolate values // from a binding's from/to constructs using the "from" and "to" interpolation prefixes respectively. FromInterpolation InterpolationSourceKey = "from" ToInterpolation InterpolationSourceKey = "to" )
type IterFunc ¶
type IterFunc[K comparable, V any] func(K, V) error
type Iterator ¶
type Iterator[K comparable, V any] struct { // contains filtered or unexported fields }
type OutputDeclaration ¶
type OutputDeclaration struct {
Name string
Ref construct.PropertyRef
Value any
}
type OutputTemplate ¶
type PropertySource ¶
type PropertySource struct {
// contains filtered or unexported fields
}
func NewPropertySource ¶
func NewPropertySource(source any) *PropertySource
func (*PropertySource) GetProperty ¶
func (p *PropertySource) GetProperty(key string) (value any, ok bool)
type Resource ¶
type Resource struct {
Id construct.ResourceId
Properties construct.Properties
}
type ResourceOwner ¶
type ResourceRef ¶
type ResourceRef struct {
ConstructURN model.URN
ResourceKey string
Property string
Type ResourceRefType
}
func (*ResourceRef) String ¶
func (r *ResourceRef) String() string
type ResourceRefType ¶
type ResourceRefType string
const ( // ResourceRefTypeTemplate is a reference to a resource template and will be fully resolved prior to constraint generation // e.g., ${resources:resourceName.property} or ${resources:resourceName} ResourceRefTypeTemplate ResourceRefType = "template" // ResourceRefTypeIaC is a reference to an infrastructure as code resource that will be resolved by the engine // e.g., ${resources:resourceName#property} ResourceRefTypeIaC ResourceRefType = "iac" // ResourceRefTypeInterpolated is an initial interpolation reference to a resource. // An interpolated value will be evaluated during initial processing and will be converted to one of the other types. ResourceRefTypeInterpolated ResourceRefType = "interpolated" )