Documentation ¶
Index ¶
- func Constructor(builder func(*Construct)) func(*Construct)
- func ConstructorWithOutputs(builder func(*Construct) interface{}) func(*Construct)
- func Outputs(v interface{}) func(*Construct)
- func Props(v interface{}) func(*Construct)
- func Scope(parent *Construct) func(*Construct)
- func Type(t string) func(*Construct)
- type Construct
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Constructor ¶
Constructor expects a function that will be called with the Construct instance as it's only parameter in order to add new children to it.
func ConstructorWithOutputs ¶
ConstructorWithOutputs expects a function that will be called with the Construct instance as it's only parameter in order to add new children to it. It also expects a value to be returned with will be assigned to the Outputs.
func Outputs ¶
func Outputs(v interface{}) func(*Construct)
Outputs will take a pointer to a struct and ensure it is initialized with reference strings (a bit like a JSON Pointer). These strings will later be used by a generator to connect resources together in the appropriate order.
func Props ¶
func Props(v interface{}) func(*Construct)
Props allows you to assign any arbitrary object, usually a struct specifically defined for your construct. So long as it can be marshalled to JSON that is all that matters.
Types ¶
type Construct ¶
type Construct struct { ID string Type string Props interface{} Outputs interface{} Parent *Construct Children []*Construct }
Construct is a class like object, create new instances with `New`.
func New ¶
New is the constructor for Construct.
It uses a functional options based API, see: https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis
Example Usage:
goconstruct.New("MyThing", goconstruct.Scope(parentThing), goconstruct.Props(&MyThingProps{}), )
func (*Construct) AddChild ¶
AddChild will create the parent and child relationship between all Constructs
func (*Construct) MarshalJSON ¶
MarshalJSON implements the Marshaler interface see https://golang.org/pkg/encoding/json/#Marshaler
func (*Construct) Synth ¶
func (c *Construct) Synth() *orderedmap.OrderedMap
Synth will convert the Construct graph into a serializable map