Class ConstructNode
Represents the construct node in the scope tree.
Inheritance
Namespace: Amazon.CDK
Assembly: Amazon.CDK.dll
Syntax (csharp)
public class ConstructNode : DeputyBase
Syntax (vb)
Public Class ConstructNode
Inherits DeputyBase
Remarks
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
Construct construct;
var constructNode = new ConstructNode(construct, construct, "id");
Synopsis
Constructors
ConstructNode(Construct, IConstruct, String) | |
ConstructNode(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
ConstructNode(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
Addr | Returns an opaque tree-unique address for this construct. |
Children | All direct children of this construct. |
DefaultChild | Returns the child construct that has the id |
Dependencies | Return all dependencies registered on this node or any of its children. |
Id | The id of this construct within the current scope. |
Locked | Returns true if this construct or the scopes in which it is defined are locked. |
Metadata | (deprecated) DEPRECATED. |
MetadataEntry | An immutable array of metadata objects associated with this construct. |
Path | The full, absolute path of this construct in the tree. |
PATH_SEP | Separator used to delimit construct path components. |
Root | |
Scope | Returns the scope in which this construct is defined. |
Scopes | All parent scopes of this construct. |
UniqueId | (deprecated) A tree-global unique alphanumeric identifier for this construct. |
Methods
AddDependency(IDependable[]) | Add an ordering dependency on another Construct. |
AddError(String) | (deprecated) DEPRECATED: Adds an { "error": <message> } metadata entry to this construct. |
AddInfo(String) | (deprecated) DEPRECATED: Adds a { "info": <message> } metadata entry to this construct. |
AddMetadata(String, Object, Object) | Adds a metadata entry to this construct. |
AddValidation(IValidation) | Add a validator to this construct Node. |
AddWarning(String) | (deprecated) DEPRECATED: Adds a { "warning": <message> } metadata entry to this construct. |
ApplyAspect(IAspect) | (deprecated) DEPRECATED: Applies the aspect to this Constructs node. |
FindAll(Nullable<ConstructOrder>) | Return this construct and all of its children in the given order. |
FindChild(String) | Return a direct child by id. |
Prepare(ConstructNode) | (deprecated) Invokes "prepare" on all constructs (depth-first, post-order) in the tree under |
SetContext(String, Object) | This can be used to set contextual values. |
Synth(ConstructNode, ISynthesisOptions) | (deprecated) Synthesizes a CloudAssembly from a construct tree. |
TryFindChild(String) | Return a direct child by id, or undefined. |
TryGetContext(String) | Retrieves a value from tree context. |
TryRemoveChild(String) | Remove the child with the given name, if present. |
Validate(ConstructNode) | Invokes "validate" on all constructs in the tree (depth-first, pre-order) and returns the list of all errors. |
Constructors
ConstructNode(Construct, IConstruct, String)
public ConstructNode(Construct host, IConstruct scope, string id)
Parameters
- host Construct
- scope IConstruct
- id System.String
ConstructNode(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected ConstructNode(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
ConstructNode(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected ConstructNode(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
Addr
Returns an opaque tree-unique address for this construct.
public virtual string Addr { get; }
Property Value
System.String
Remarks
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 value: c83a2846e506bcc5f10682b564084bca2d275709ee
Children
All direct children of this construct.
public virtual IConstruct[] Children { get; }
Property Value
DefaultChild
Returns the child construct that has the id Default
or Resource"
.
public virtual IConstruct DefaultChild { get; set; }
Property Value
a construct or undefined if there is no default child
Remarks
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.
Throws: if there is more than one child
Dependencies
Return all dependencies registered on this node or any of its children.
public virtual IDependency[] Dependencies { get; }
Property Value
Id
The id of this construct within the current scope.
public virtual string Id { get; }
Property Value
System.String
Remarks
This is a a scope-unique id. To obtain an app-unique id for this construct, use uniqueId
.
Locked
Returns true if this construct or the scopes in which it is defined are locked.
public virtual bool Locked { get; }
Property Value
System.Boolean
Metadata
(deprecated) DEPRECATED.
public virtual IMetadataEntry[] Metadata { get; }
Property Value
Remarks
Stability: Deprecated
MetadataEntry
An immutable array of metadata objects associated with this construct.
public virtual IMetadataEntry[] MetadataEntry { get; }
Property Value
Constructs.IMetadataEntry[]
Remarks
This can be used, for example, to implement support for deprecation notices, source mapping, etc.
Path
The full, absolute path of this construct in the tree.
public virtual string Path { get; }
Property Value
System.String
Remarks
Components are separated by '/'.
PATH_SEP
Separator used to delimit construct path components.
public static string PATH_SEP { get; }
Property Value
System.String
Root
Scope
Returns the scope in which this construct is defined.
public virtual IConstruct Scope { get; }
Property Value
Remarks
The value is undefined
at the root of the construct scope tree.
Scopes
All parent scopes of this construct.
public virtual IConstruct[] Scopes { get; }
Property Value
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.
UniqueId
(deprecated) A tree-global unique alphanumeric identifier for this construct.
public virtual string UniqueId { get; }
Property Value
System.String
Remarks
Includes all components of the tree.
Stability: Deprecated
Methods
AddDependency(IDependable[])
Add an ordering dependency on another Construct.
public virtual void AddDependency(params IDependable[] dependencies)
Parameters
- dependencies IDependable[]
Remarks
All constructs in the dependency's scope will be deployed before any construct in this construct's scope.
AddError(String)
(deprecated) DEPRECATED: Adds an { "error": <message> } metadata entry to this construct.
public virtual void AddError(string message)
Parameters
- message System.String
The error message.
Remarks
The toolkit will fail synthesis when errors are reported.
Stability: Deprecated
AddInfo(String)
(deprecated) DEPRECATED: Adds a { "info": <message> } metadata entry to this construct.
public virtual void AddInfo(string message)
Parameters
- message System.String
The info message.
Remarks
The toolkit will display the info message when apps are synthesized.
Stability: Deprecated
AddMetadata(String, Object, Object)
Adds a metadata entry to this construct.
public virtual void AddMetadata(string type, object data, object fromFunction = null)
Parameters
- type System.String
a string denoting the type of metadata.
- data System.Object
the value of the metadata (can be a Token).
- fromFunction System.Object
a function under which to restrict the metadata entry's stack trace (defaults to this.addMetadata).
Remarks
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.
AddValidation(IValidation)
Add a validator to this construct Node.
public virtual void AddValidation(IValidation validation)
Parameters
- validation Constructs.IValidation
AddWarning(String)
(deprecated) DEPRECATED: Adds a { "warning": <message> } metadata entry to this construct.
public virtual void AddWarning(string message)
Parameters
- message System.String
The warning message.
Remarks
The toolkit will display the warning when an app is synthesized, or fail if run in --strict mode.
Stability: Deprecated
ApplyAspect(IAspect)
(deprecated) DEPRECATED: Applies the aspect to this Constructs node.
public virtual void ApplyAspect(IAspect aspect)
Parameters
- aspect IAspect
Remarks
Stability: Deprecated
FindAll(Nullable<ConstructOrder>)
Return this construct and all of its children in the given order.
public virtual IConstruct[] FindAll(Nullable<ConstructOrder> order = null)
Parameters
- order System.Nullable<ConstructOrder>
Returns
FindChild(String)
Return a direct child by id.
public virtual IConstruct FindChild(string id)
Parameters
- id System.String
Identifier of direct child.
Returns
Child with the given id.
Remarks
Throws an error if the child is not found.
Prepare(ConstructNode)
(deprecated) Invokes "prepare" on all constructs (depth-first, post-order) in the tree under node
.
public static void Prepare(ConstructNode node)
Parameters
- node ConstructNode
The root node.
Remarks
Stability: Deprecated
SetContext(String, Object)
This can be used to set contextual values.
public virtual void SetContext(string key, object value)
Parameters
- key System.String
The context key.
- value System.Object
The context value.
Remarks
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.
Synth(ConstructNode, ISynthesisOptions)
(deprecated) Synthesizes a CloudAssembly from a construct tree.
public static CloudAssembly Synth(ConstructNode node, ISynthesisOptions options = null)
Parameters
- node ConstructNode
The root of the construct tree.
- options ISynthesisOptions
Synthesis options.
Returns
Remarks
Stability: Deprecated
TryFindChild(String)
Return a direct child by id, or undefined.
public virtual IConstruct TryFindChild(string id)
Parameters
- id System.String
Identifier of direct child.
Returns
the child if found, or undefined
TryGetContext(String)
Retrieves a value from tree context.
public virtual object TryGetContext(string key)
Parameters
- key System.String
The context key.
Returns
System.Object
The context value or undefined
if there is no context value for the key.
Remarks
Context is usually initialized at the root, but can be overridden at any point in the tree.
TryRemoveChild(String)
Remove the child with the given name, if present.
public virtual bool TryRemoveChild(string childName)
Parameters
- childName System.String
Returns
System.Boolean
Whether a child with the given name was deleted.
Validate(ConstructNode)
Invokes "validate" on all constructs in the tree (depth-first, pre-order) and returns the list of all errors.
public static IValidationError[] Validate(ConstructNode node)
Parameters
- node ConstructNode
The root node.
Returns
Remarks
An empty list indicates that there are no errors.