Stack
- Implements: ITaggable
A root construct which represents a single ROS stack.
Initializers
using AlibabaCloud.SDK.ROS.CDK.Core;
new Stack(Construct Scope = null, string Id = null, StackProps Props = null);
Name | Type | Description |
---|---|---|
Scope |
Construct |
Parent of this stack, usually a Program instance. |
Id |
string |
The construct ID of this stack. |
Props |
StackProps |
Stack properties. |
Scope
Optional
- Type: Construct
Parent of this stack, usually a Program instance.
Id
Optional
- Type: string
The construct ID of this stack.
If stackName
is not explicitly
defined, this id (and any parent IDs) will be used to determine the
physical ID of the stack.
Props
Optional
- Type: StackProps
Stack properties.
Methods
Name | Description |
---|---|
ToString |
Returns a string representation of this construct. |
Synthesize |
Allows this construct to emit artifacts into the cloud assembly during synthesis. |
AddDependency |
Add a dependency between this stack and another stack. |
GetLogicalId |
Allocates a stack-unique logical identity for a specific resource. |
RenameLogicalId |
Rename a generated logical identities. |
Resolve |
Resolve a tokenized value in the context of the current stack. |
ToJsonString |
Convert an object, potentially containing tokens, to a JSON string. |
ToString
private string ToString()
Returns a string representation of this construct.
Synthesize
private void Synthesize(ISynthesisSession Session)
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.
- Type: ISynthesisSession
AddDependency
private void AddDependency(Stack Target, string Reason = null)
Add a dependency between this stack and another stack.
This can be used to define dependencies between any two stacks within an app, and also supports nested stacks.
- Type: Stack
- Type: string
GetLogicalId
private string GetLogicalId(RosElement Element)
Allocates a stack-unique logical identity for a specific resource.
This method is called when a RosElement
is created and used to render the
initial logical identity of resources. Logical ID renames are applied at
this stage.
This method uses the protected method allocateLogicalId
to render the
logical ID for an element. To modify the naming scheme, extend the Stack
class and override this method.
- Type: RosElement
The ROS element for which a logical identity is needed.
RenameLogicalId
private void RenameLogicalId(string OldId, string NewId)
Rename a generated logical identities.
To modify the naming scheme strategy, extend the Stack
class and
override the allocateLogicalId
method.
- Type: string
- Type: string
Resolve
private object Resolve(object Obj)
Resolve a tokenized value in the context of the current stack.
- Type: object
ToJsonString
private string ToJsonString(object Obj, double Space = null)
Convert an object, potentially containing tokens, to a JSON string.
- Type: object
- Type: double
Static Functions
Name | Description |
---|---|
IsConstruct |
Return whether the given object is a Construct. |
IsStack |
Return whether the given object is a Stack. |
Of |
Looks up the first stack scope in which construct is defined. |
IsConstruct
using AlibabaCloud.SDK.ROS.CDK.Core;
Stack.IsConstruct(object X);
Return whether the given object is a Construct.
- Type: object
IsStack
using AlibabaCloud.SDK.ROS.CDK.Core;
Stack.IsStack(object X);
Return whether the given object is a Stack.
We do attribute detection since we can't reliably use 'instanceof'.
- Type: object
Of
using AlibabaCloud.SDK.ROS.CDK.Core;
Stack.Of(IConstruct Construct);
Looks up the first stack scope in which construct
is defined.
Fails if there is no stack up the tree.
- Type: IConstruct
The construct to start the search from.
Properties
Name | Type | Description |
---|---|---|
Node |
ConstructNode |
The construct tree node associated with this construct. |
Account |
string |
The ALIYUN account into which this stack will be deployed. |
ArtifactId |
string |
The ID of the cloud assembly artifact for this stack. |
BundlingRequired |
bool |
Indicates whether the stack requires bundling or not. |
Dependencies |
Stack[] |
Return the stacks this stack depends on. |
EnableResourcePropertyConstraint |
bool |
No description. |
Nested |
bool |
Indicates if this is a nested stack, in which case parentStack will include a reference to it's parent. |
Region |
string |
The ALIYUN region into which this stack will be deployed (e.g. cn-beijing ). |
StackId |
string |
The ID of the stack. |
StackName |
string |
The concrete ROS physical stack name. |
Synthesizer |
IStackSynthesizer |
Synthesis method for this stack. |
Tags |
TagManager |
Tags to be applied to the stack. |
TemplateFile |
string |
The name of the ROS template file emitted to the output directory during synthesis. |
TemplateOptions |
ITemplateOptions |
Options for ROS template (like version, description). |
NestedStackParent |
Stack |
If this is a nested stack, returns it's parent stack. |
NestedStackResource |
RosResource |
If this is a nested stack, this represents its ALIYUN::ROS::Stack resource. |
ParentStack |
Stack |
Returns the parent of a nested stack. |
Roles |
RamRoles |
No description. |
Node
Required
public ConstructNode Node { get; }
- Type: ConstructNode
The construct tree node associated with this construct.
Account
Required
public string Account { get; }
- Type: string
The ALIYUN account into which this stack will be deployed.
This value is resolved according to the following rules:
- The value provided to
env.account
when the stack is defined. This can either be a concrete account or theALIYUN.ACCOUNT_ID
token. ALIYUN.ACCOUNT_ID
, which represents the ROS intrinsic reference{ "Ref": "ALIYUN::AccountId" }
encoded as a string token.
Preferably, you should use the return value as an opaque string and not
attempt to parse it to implement your logic. If you do, you must first
check that it is a concrete value an not an unresolved token. If this
value is an unresolved token (Token.isUnresolved(stack.account)
returns
true
), this implies that the user wishes that this stack will synthesize
into a account-agnostic template. In this case, your code should either
fail (throw an error, emit a synth error using Annotations.of(construct).addError()
) or
implement some other region-agnostic behavior.
ArtifactId
Required
public string ArtifactId { get; }
- Type: string
The ID of the cloud assembly artifact for this stack.
BundlingRequired
Required
public bool BundlingRequired { get; }
- Type: bool
Indicates whether the stack requires bundling or not.
Dependencies
Required
public Stack[] Dependencies { get; }
- Type: Stack[]
Return the stacks this stack depends on.
EnableResourcePropertyConstraint
Required
public bool EnableResourcePropertyConstraint { get; }
- Type: bool
Nested
Required
public bool Nested { get; }
- Type: bool
Indicates if this is a nested stack, in which case parentStack
will include a reference to it's parent.
Region
Required
public string Region { get; }
- Type: string
The ALIYUN region into which this stack will be deployed (e.g. cn-beijing
).
This value is resolved according to the following rules:
- The value provided to
env.region
when the stack is defined. This can either be a concrete region or theALIYUN.REGION
token. ALIYUN.REGION
, which is represents the ROS intrinsic reference{ "Ref": "ALIYUN::Region" }
encoded as a string token.
Preferably, you should use the return value as an opaque string and not
attempt to parse it to implement your logic. If you do, you must first
check that it is a concrete value an not an unresolved token. If this
value is an unresolved token (Token.isUnresolved(stack.region)
returns
true
), this implies that the user wishes that this stack will synthesize
into a region-agnostic template. In this case, your code should either
fail (throw an error, emit a synth error using Annotations.of(construct).addError()
) or
implement some other region-agnostic behavior.
StackId
Required
public string StackId { get; }
- Type: string
The ID of the stack.
StackName
Required
public string StackName { get; }
- Type: string
The concrete ROS physical stack name.
This is either the name defined explicitly in the stackName
prop or
allocated based on the stack's location in the construct tree. Stacks that
are directly defined under the app use their construct id
as their stack
name. Stacks that are defined deeper within the tree will use a hashed naming
scheme based on the construct path to ensure uniqueness.
Synthesizer
Required
public IStackSynthesizer Synthesizer { get; }
- Type: IStackSynthesizer
Synthesis method for this stack.
Tags
Required
public TagManager Tags { get; }
- Type: TagManager
Tags to be applied to the stack.
TemplateFile
Required
public string TemplateFile { get; }
- Type: string
The name of the ROS template file emitted to the output directory during synthesis.
Example
// Example automatically generated from non-compiling source. May contain errors.
MyStack.Template.Json;
TemplateOptions
Required
public ITemplateOptions TemplateOptions { get; }
- Type: ITemplateOptions
Options for ROS template (like version, description).
NestedStackParent
Optional
public Stack NestedStackParent { get; }
- Type: Stack
If this is a nested stack, returns it's parent stack.
NestedStackResource
Optional
public RosResource NestedStackResource { get; }
- Type: RosResource
If this is a nested stack, this represents its ALIYUN::ROS::Stack
resource.
undefined
for top-level (non-nested) stacks.
~~ParentStack
~~Optional
- Deprecated: use
nestedStackParent
public Stack ParentStack { get; }
- Type: Stack
Returns the parent of a nested stack.
Roles
Optional
public RamRoles Roles { get; }
- Type: RamRoles