constructs package - github.com/aws/constructs-go/constructs/v10 - Go Packages
A programming model for software-defined state
- 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 NewRootConstruct_Override(r RootConstruct, id *string)
- func Node_PATH_SEP() *string
- func RootConstruct_IsConstruct(x interface{}) *bool
- type Construct
- type ConstructOrder
- type Dependable
- type DependencyGroup
- type IConstruct
- type IDependable
- type IMixin
- type IValidation
- type MetadataEntry
- type MetadataOptions
- type Node
- type RootConstruct
This section is empty.
This section is empty.
func Construct_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func Dependable_Implement(instance IDependable, trait Dependable)
Turn any object into an IDependable.
func NewDependable_Override(d Dependable)
func NewDependencyGroup_Override(d DependencyGroup, deps ...IDependable)
func NewNode_Override(n Node, host Construct, scope IConstruct, id *string)
func NewRootConstruct_Override(r RootConstruct, id *string)
Creates a new root construct node.
func RootConstruct_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
type Construct interface {
IConstruct
Node() Node
ToString() *string
With(mixins ...IMixin) IConstruct
}
Represents the building block of the construct graph.
All constructs besides the root construct must be created within the scope of another construct.
Creates a new construct node.
In what order to return constructs.
const ( ConstructOrder_PREORDER ConstructOrder = "PREORDER" ConstructOrder_POSTORDER ConstructOrder = "POSTORDER" )
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.
Example:
// Usage
const roots = Dependable.of(construct).dependencyRoots;
// Definition
Dependable.implement(construct, {
dependencyRoots: [construct],
});
func Dependable_Get(instance IDependable) Dependable
Return the matching Dependable for the given class instance. Deprecated: use `of`.
func Dependable_Of(instance IDependable) Dependable
Return the matching Dependable for the given class instance.
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.
func NewDependencyGroup(deps ...IDependable) DependencyGroup
type IConstruct interface {
IDependable
With(mixins ...IMixin) IConstruct
Node() Node
}
Represents a construct.
type IDependable interface {
}
Trait marker for classes that can be depended upon.
The presence of this interface indicates that an object has an `IDependable` 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 IMixin interface {
ApplyTo(construct IConstruct)
Supports(construct IConstruct) *bool
}
A mixin is a reusable piece of functionality that can be applied to constructs to add behavior, properties, or modify existing functionality without inheritance.
type IValidation interface {
Validate() *[]*string
}
Implement this interface in order for the construct to be able to validate itself.
type MetadataEntry struct {
Data interface{} `field:"required" json:"data" yaml:"data"`
Type *string `field:"required" json:"type" yaml:"type"`
Trace *[]*string `field:"optional" json:"trace" yaml:"trace"`
}
An entry in the construct metadata table.
type MetadataOptions struct {
StackTrace *bool `field:"optional" json:"stackTrace" yaml:"stackTrace"`
TraceFromFunction interface{} `field:"optional" json:"traceFromFunction" yaml:"traceFromFunction"`
}
Options for `construct.addMetadata()`.
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
GetAllContext(defaults *map[string]interface{}) interface{}
GetContext(key *string) interface{}
Lock()
SetContext(key *string, value interface{})
TryFindChild(id *string) IConstruct
TryGetContext(key *string) interface{}
TryRemoveChild(childName *string) *bool
Validate() *[]*string
With(mixins ...IMixin) IConstruct
}
Represents the construct node in the scope tree.
func Node_Of(construct IConstruct) Node
Returns the node associated with a construct. Deprecated: use `construct.node` instead
type RootConstruct interface {
Construct
Node() Node
ToString() *string
With(mixins ...IMixin) IConstruct
}
Creates a new root construct node.
The root construct represents the top of the construct tree and is not contained within a parent scope itself. For root constructs, the id is optional.
Creates a new root construct node.