Documentation ¶
Overview ¶
A programming model for composable configuration
Index ¶
- func ConstructMetadata_DISABLE_STACK_TRACE_IN_METADATA() *string
- func ConstructMetadata_ERROR_METADATA_KEY() *string
- func ConstructMetadata_INFO_METADATA_KEY() *string
- func ConstructMetadata_WARNING_METADATA_KEY() *string
- func NewConstruct_Override(c Construct, scope Construct, id *string, options *ConstructOptions)
- func NewNode_Override(n Node, host Construct, scope IConstruct, id *string)
- func Node_PATH_SEP() *string
- type Construct
- type ConstructMetadata
- type ConstructOptions
- type ConstructOrder
- type Dependency
- type IAspect
- type IConstruct
- type INodeFactory
- type ISynthesisSession
- type IValidation
- type MetadataEntry
- type Node
- type SynthesisOptions
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConstructMetadata_DISABLE_STACK_TRACE_IN_METADATA ¶ added in v3.3.69
func ConstructMetadata_DISABLE_STACK_TRACE_IN_METADATA() *string
func ConstructMetadata_ERROR_METADATA_KEY ¶ added in v3.3.69
func ConstructMetadata_ERROR_METADATA_KEY() *string
func ConstructMetadata_INFO_METADATA_KEY ¶ added in v3.3.69
func ConstructMetadata_INFO_METADATA_KEY() *string
func ConstructMetadata_WARNING_METADATA_KEY ¶ added in v3.3.69
func ConstructMetadata_WARNING_METADATA_KEY() *string
func NewConstruct_Override ¶ added in v3.3.69
func NewConstruct_Override(c Construct, scope Construct, id *string, options *ConstructOptions)
Creates a new construct node.
func NewNode_Override ¶ added in v3.3.69
func NewNode_Override(n Node, host Construct, scope IConstruct, id *string)
func Node_PATH_SEP ¶ added in v3.3.69
func Node_PATH_SEP() *string
Types ¶
type Construct ¶
type Construct interface { IConstruct // Perform final modifications before synthesis. // // This method can be implemented by derived constructs in order to perform // final changes before synthesis. prepare() will be called after child // constructs have been prepared. // // This is an advanced framework feature. Only use this if you // understand the implications. OnPrepare() // Allows this construct to emit artifacts into the cloud assembly during synthesis. // // This method is usually implemented by framework-level constructs such as `Stack` and `Asset` // as they participate in synthesizing the cloud assembly. OnSynthesize(session ISynthesisSession) // 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. // Deprecated: use `Node.addValidation()` to subscribe validation functions on this construct // instead of overriding this method. OnValidate() *[]*string // Returns a string representation of this construct. 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 ¶
func NewConstruct(scope Construct, id *string, options *ConstructOptions) Construct
Creates a new construct node.
type ConstructOptions ¶
type ConstructOptions struct { // A factory for attaching `Node`s to the construct. NodeFactory INodeFactory `field:"optional" json:"nodeFactory" yaml:"nodeFactory"` }
Options for creating constructs.
type ConstructOrder ¶
type ConstructOrder string
In what order to return constructs.
const ( // Depth-first, pre-order. ConstructOrder_PREORDER ConstructOrder = "PREORDER" // Depth-first, post-order (leaf nodes first). ConstructOrder_POSTORDER ConstructOrder = "POSTORDER" )
type Dependency ¶
type Dependency struct { // Source the dependency. Source IConstruct `field:"required" json:"source" yaml:"source"` // Target of the dependency. Target IConstruct `field:"required" json:"target" yaml:"target"` }
A single dependency.
type IAspect ¶
type IAspect interface { // All aspects can visit an IConstruct. Visit(node IConstruct) }
Represents an Aspect.
type INodeFactory ¶
type INodeFactory interface { // Returns a new `Node` associated with `host`. CreateNode(host Construct, scope IConstruct, id *string) Node }
A factory for attaching `Node`s to the construct.
type ISynthesisSession ¶
type ISynthesisSession interface { // The output directory for this synthesis session. Outdir() *string }
Represents a single session of synthesis.
Passed into `construct.onSynthesize()` methods.
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. // // 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.
type MetadataEntry ¶
type MetadataEntry struct { // The data. Data interface{} `field:"required" json:"data" yaml:"data"` // The metadata entry type. Type *string `field:"required" json:"type" yaml:"type"` // Stack trace. // // Can be omitted by setting the context key // `ConstructMetadata.DISABLE_STACK_TRACE_IN_METADATA` to 1. Trace *[]*string `field:"optional" json:"trace" yaml:"trace"` }
An entry in the construct metadata table.
type Node ¶
type Node interface { // Returns an opaque tree-unique address for this construct. // // Addresses are 42 characters hexadecimal strings. They begin with "c8" // followed by 40 lowercase hexadecimal characters (0-9a-f). // // Addresses are calculated using a SHA-1 of the components of the construct // path. // // To enable refactorings of construct trees, constructs with the ID `Default` // will be excluded from the calculation. In those cases constructs in the // same tree may have the same addreess. // // Example: // c83a2846e506bcc5f10682b564084bca2d275709ee // Addr() *string // All direct children of this construct. Children() *[]IConstruct // Returns the child construct that has the id `Default` or `Resource"`. // // This is usually the construct that provides the bulk of the underlying functionality. // Useful for modifications of the underlying construct that are not available at the higher levels. // Override the defaultChild property. // // This should only be used in the cases where the correct // default child is not named 'Resource' or 'Default' as it // should be. // // If you set this to undefined, the default behavior of finding // the child named 'Resource' or 'Default' will be used. // // Returns: a construct or undefined if there is no default child. DefaultChild() IConstruct SetDefaultChild(val IConstruct) // Return all dependencies registered on this node or any of its children. Dependencies() *[]*Dependency // The id of this construct within the current scope. // // This is a a scope-unique id. To obtain an app-unique id for this construct, use `uniqueId`. Id() *string // Returns true if this construct or the scopes in which it is defined are locked. Locked() *bool // An immutable array of metadata objects associated with this construct. // // This can be used, for example, to implement support for deprecation notices, source mapping, etc. Metadata() *[]*MetadataEntry // The full, absolute path of this construct in the tree. // // Components are separated by '/'. Path() *string // Returns the root of the construct tree. // // Returns: The root of the construct tree. Root() IConstruct // Returns the scope in which this construct is defined. // // The value is `undefined` at the root of the construct scope tree. Scope() IConstruct // All parent scopes of this construct. // // Returns: a list of parent scopes. The last element in the list will always // be the current construct and the first element will be the root of the // tree. Scopes() *[]IConstruct // A tree-global unique alphanumeric identifier for this construct. // // Includes // all components of the tree. // Deprecated: please avoid using this property and use `addr` to form unique names. // This algorithm uses MD5, which is not FIPS-complient and also excludes the // identity of the root construct from the calculation. UniqueId() *string // Add an ordering dependency on another Construct. // // All constructs in the dependency's scope will be deployed before any // construct in this construct's scope. AddDependency(dependencies ...IConstruct) // Adds an { "error": <message> } metadata entry to this construct. // // The toolkit will fail synthesis when errors are reported. AddError(message *string) // Adds a { "info": <message> } metadata entry to this construct. // // The toolkit will display the info message when apps are synthesized. AddInfo(message *string) // Adds a metadata entry to this construct. // // Entries are arbitrary values and will also include a stack trace to allow tracing back to // the code location for when the entry was added. It can be used, for example, to include source // mapping in CloudFormation templates to improve diagnostics. AddMetadata(type_ *string, data interface{}, fromFunction interface{}) // Adds a validation to this construct. // // When `node.validate()` is called, the `validate()` method will be called on // all validations and all errors will be returned. AddValidation(validation IValidation) // Adds a { "warning": <message> } metadata entry to this construct. // // The toolkit will display the warning when an app is synthesized, or fail // if run in --strict mode. AddWarning(message *string) // Applies the aspect to this Constructs node. ApplyAspect(aspect IAspect) // Return this construct and all of its children in the given order. FindAll(order ConstructOrder) *[]IConstruct // Return a direct child by id. // // Throws an error if the child is not found. // // Returns: Child with the given id. FindChild(id *string) IConstruct // Invokes "prepare" on all constructs (depth-first, post-order) in the tree under `node`. Prepare() // This can be used to set contextual values. // // Context must be set before any children are added, since children may consult context info during construction. // If the key already exists, it will be overridden. SetContext(key *string, value interface{}) // Synthesizes a CloudAssembly from a construct tree. Synthesize(options *SynthesisOptions) // Return a direct child by id, or undefined. // // Returns: the child if found, or undefined. TryFindChild(id *string) IConstruct // Retrieves a value from tree context. // // Context is usually initialized at the root, but can be overridden at any point in the tree. // // Returns: The context value or `undefined` if there is no context value for thie key. TryGetContext(key *string) interface{} // Remove the child with the given name, if present. // // Returns: Whether a child with the given name was deleted. // Experimental. TryRemoveChild(childName *string) *bool // Validates tree (depth-first, pre-order) and returns the list of all errors. // // An empty list indicates that there are no errors. Validate() *[]*ValidationError }
Represents the construct node in the scope tree.
func Node_Of ¶
func Node_Of(construct IConstruct) Node
Returns the node associated with a construct.
type SynthesisOptions ¶
type SynthesisOptions struct { // The output directory into which to synthesize the cloud assembly. Outdir *string `field:"required" json:"outdir" yaml:"outdir"` // Additional context passed into the synthesis session object when `construct.synth` is called. SessionContext *map[string]interface{} `field:"optional" json:"sessionContext" yaml:"sessionContext"` // Whether synthesis should skip the validation phase. SkipValidation *bool `field:"optional" json:"skipValidation" yaml:"skipValidation"` }
Options for synthesis.
type ValidationError ¶
type ValidationError struct { // The error message. Message *string `field:"required" json:"message" yaml:"message"` // The construct which emitted the error. Source Construct `field:"required" json:"source" yaml:"source"` }
An error returned during the validation phase.