Documentation
¶
Overview ¶
A programming model for software-defined state
Index ¶
- func Construct_IsConstruct(x interface{}) *bool
- func Dependable_Implement(instance IDependable, trait Dependable)
- func NewConstruct_Override(c Construct, scope Construct, id *string)
- func NewDependable_Override(d Dependable)
- func NewDependencyGroup_Override(d DependencyGroup, deps ...IDependable)
- func NewNode_Override(n Node, host Construct, scope IConstruct, id *string)
- func Node_PATH_SEP() *string
- type Construct
- type ConstructOrder
- type Dependable
- type DependencyGroup
- type IConstruct
- type IDependable
- type IValidation
- type MetadataEntry
- type MetadataOptions
- type Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Construct_IsConstruct ¶
func Construct_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead
func Dependable_Implement ¶
func Dependable_Implement(instance IDependable, trait Dependable)
Turn any object into an IDependable. Experimental.
func NewConstruct_Override ¶
Creates a new construct node.
func NewDependencyGroup_Override ¶
func NewDependencyGroup_Override(d DependencyGroup, deps ...IDependable)
Experimental.
func NewNode_Override ¶
func NewNode_Override(n Node, host Construct, scope IConstruct, id *string)
func Node_PATH_SEP ¶
func Node_PATH_SEP() *string
Types ¶
type Construct ¶
type Construct interface {
IConstruct
Node() Node
ToString() *string
}
Represents the building block of the construct graph.
All constructs besides the root construct must be created within the scope of another construct.
func NewConstruct ¶
Creates a new construct node.
type ConstructOrder ¶
type ConstructOrder string
In what order to return constructs.
const ( ConstructOrder_PREORDER ConstructOrder = "PREORDER" ConstructOrder_POSTORDER ConstructOrder = "POSTORDER" )
type Dependable ¶
type Dependable interface {
DependencyRoots() *[]IConstruct
}
Trait for IDependable.
Traits are interfaces that are privately implemented by objects. Instead of showing up in the public interface of a class, they need to be queried explicitly. This is used to implement certain framework features that are not intended to be used by Construct consumers, and so should be hidden from accidental use.
TODO: EXAMPLE
Experimental.
func Dependable_Get ¶
func Dependable_Get(instance IDependable) Dependable
Return the matching Dependable for the given class instance. Deprecated: use `of`
func Dependable_Of ¶
func Dependable_Of(instance IDependable) Dependable
Return the matching Dependable for the given class instance. Experimental.
type DependencyGroup ¶
type DependencyGroup interface {
IDependable
Add(scopes ...IDependable)
}
A set of constructs to be used as a dependable.
This class can be used when a set of constructs which are disjoint in the construct tree needs to be combined to be used as a single dependable. Experimental.
func NewDependencyGroup ¶
func NewDependencyGroup(deps ...IDependable) DependencyGroup
Experimental.
type IConstruct ¶
type IConstruct interface {
IDependable
// The tree node.
Node() Node
}
Represents a construct.
type IDependable ¶
type IDependable interface {
}
Trait marker for classes that can be depended upon.
The presence of this interface indicates that an object has an `IDependableTrait` implementation.
This interface can be used to take an (ordering) dependency on a set of constructs. An ordering dependency implies that the resources represented by those constructs are deployed before the resources depending ON them are deployed.
type IValidation ¶
type IValidation interface {
// Validate the current construct.
//
// This method can be implemented by derived constructs in order to perform
// validation logic. It is called on all constructs before synthesis.
// Validate the current construct.
//
// This method can be implemented by derived constructs in order to perform
// validation logic. It is called on all constructs before synthesis.
//
// Returns: An array of validation error messages, or an empty array if there the construct is valid.
Validate() *[]*string
}
Implement this interface in order for the construct to be able to validate itself.
Implement this interface in order for the construct to be able to validate itself.
type MetadataEntry ¶
type MetadataEntry struct {
// The data.
Data interface{} `json:"data" yaml:"data"`
// The metadata entry type.
Type *string `json:"type" yaml:"type"`
// Stack trace at the point of adding the metadata.
//
// Only available if `addMetadata()` is called with `stackTrace: true`.
Trace *[]*string `json:"trace" yaml:"trace"`
}
An entry in the construct metadata table.
type MetadataOptions ¶
type MetadataOptions struct {
// Include stack trace with metadata entry.
StackTrace *bool `json:"stackTrace" yaml:"stackTrace"`
// A JavaScript function to begin tracing from.
//
// This option is ignored unless `stackTrace` is `true`.
TraceFromFunction interface{} `json:"traceFromFunction" yaml:"traceFromFunction"`
}
Options for `construct.addMetadata()`.
type Node ¶
type Node interface {
Addr() *string
Children() *[]IConstruct
DefaultChild() IConstruct
SetDefaultChild(val IConstruct)
Dependencies() *[]IConstruct
Id() *string
Locked() *bool
Metadata() *[]*MetadataEntry
Path() *string
Root() IConstruct
Scope() IConstruct
Scopes() *[]IConstruct
AddDependency(deps ...IDependable)
AddMetadata(type_ *string, data interface{}, options *MetadataOptions)
AddValidation(validation IValidation)
FindAll(order ConstructOrder) *[]IConstruct
FindChild(id *string) IConstruct
Lock()
SetContext(key *string, value interface{})
TryFindChild(id *string) IConstruct
TryGetContext(key *string) interface{}
TryRemoveChild(childName *string) *bool
Validate() *[]*string
}
Represents the construct node in the scope tree.
func Node_Of ¶
func Node_Of(construct IConstruct) Node
Returns the node associated with a construct. Deprecated: use `construct.node` instead