Skip to content

NestedStack

Initializers

import com.aliyun.ros.cdk.core.NestedStack;
NestedStack.Builder.create(Construct scope, java.lang.String id)
//  .parameters(java.util.Map<java.lang.String, java.lang.Object>)
//  .templateBody(java.lang.String)
//  .templateUrl(java.lang.String)
//  .timeout(java.lang.Number)
    .build();
Name Type Description
scope Construct No description.
id java.lang.String No description.
parameters java.util.Map No description.
templateBody java.lang.String No description.
templateUrl java.lang.String No description.
timeout java.lang.Number No description.

scopeRequired


idRequired

  • Type: java.lang.String

parametersOptional

  • Type: java.util.Map

templateBodyOptional

  • Type: java.lang.String

templateUrlOptional

  • Type: java.lang.String

timeoutOptional

  • Type: java.lang.Number

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.
getAtt No description.
setParameter No description.

toString

public java.lang.String toString()

Returns a string representation of this construct.

synthesize

public 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.

sessionRequired


addDependency

public void addDependency(Stack target)
public void addDependency(Stack target, java.lang.String reason)

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.

targetRequired


reasonOptional

  • Type: java.lang.String

getLogicalId

public java.lang.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.

elementRequired

The ROS element for which a logical identity is needed.


renameLogicalId

public void renameLogicalId(java.lang.String oldId, java.lang.String newId)

Rename a generated logical identities.

To modify the naming scheme strategy, extend the Stack class and override the allocateLogicalId method.

oldIdRequired

  • Type: java.lang.String

newIdRequired

  • Type: java.lang.String

resolve

public java.lang.Object resolve(java.lang.Object obj)

Resolve a tokenized value in the context of the current stack.

objRequired

  • Type: java.lang.Object

toJsonString

public java.lang.String toJsonString(java.lang.Object obj)
public java.lang.String toJsonString(java.lang.Object obj, java.lang.Number space)

Convert an object, potentially containing tokens, to a JSON string.

objRequired

  • Type: java.lang.Object

spaceOptional

  • Type: java.lang.Number

getAtt

public java.lang.String getAtt(java.lang.String attributeName)

attributeNameRequired

  • Type: java.lang.String

setParameter

public void setParameter(java.lang.String name, java.lang.Object value)

nameRequired

  • Type: java.lang.String

valueRequired

  • Type: java.lang.Object

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.
isNestedStack No description.

isConstruct

import com.aliyun.ros.cdk.core.NestedStack;
NestedStack.isConstruct(java.lang.Object x)

Return whether the given object is a Construct.

xRequired

  • Type: java.lang.Object

isStack

import com.aliyun.ros.cdk.core.NestedStack;
NestedStack.isStack(java.lang.Object x)

Return whether the given object is a Stack.

We do attribute detection since we can't reliably use 'instanceof'.

xRequired

  • Type: java.lang.Object

of

import com.aliyun.ros.cdk.core.NestedStack;
NestedStack.of(IConstruct construct)

Looks up the first stack scope in which construct is defined.

Fails if there is no stack up the tree.

constructRequired

The construct to start the search from.


isNestedStack

import com.aliyun.ros.cdk.core.NestedStack;
NestedStack.isNestedStack(java.lang.Object x)

xRequired

  • Type: java.lang.Object

Properties

Name Type Description
node ConstructNode The construct tree node associated with this construct.
account java.lang.String The ALIYUN account into which this stack will be deployed.
artifactId java.lang.String The ID of the cloud assembly artifact for this stack.
bundlingRequired java.lang.Boolean Indicates whether the stack requires bundling or not.
dependencies java.util.List<Stack> Return the stacks this stack depends on.
enableResourcePropertyConstraint java.lang.Boolean No description.
nested java.lang.Boolean Indicates if this is a nested stack, in which case parentStack will include a reference to it's parent.
region java.lang.String The ALIYUN region into which this stack will be deployed (e.g. cn-beijing).
stackId java.lang.String The ID of the stack.
stackName java.lang.String The concrete ROS physical stack name.
synthesizer IStackSynthesizer Synthesis method for this stack.
tags TagManager Tags to be applied to the stack.
templateFile java.lang.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.

nodeRequired

public ConstructNode getNode();

The construct tree node associated with this construct.


accountRequired

public java.lang.String getAccount();
  • Type: java.lang.String

The ALIYUN account into which this stack will be deployed.

This value is resolved according to the following rules:

  1. The value provided to env.account when the stack is defined. This can either be a concrete account or the ALIYUN.ACCOUNT_ID token.
  2. 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.


artifactIdRequired

public java.lang.String getArtifactId();
  • Type: java.lang.String

The ID of the cloud assembly artifact for this stack.


bundlingRequiredRequired

public java.lang.Boolean getBundlingRequired();
  • Type: java.lang.Boolean

Indicates whether the stack requires bundling or not.


dependenciesRequired

public java.util.List<Stack> getDependencies();
  • Type: java.util.List<Stack>

Return the stacks this stack depends on.


enableResourcePropertyConstraintRequired

public java.lang.Boolean getEnableResourcePropertyConstraint();
  • Type: java.lang.Boolean

nestedRequired

public java.lang.Boolean getNested();
  • Type: java.lang.Boolean

Indicates if this is a nested stack, in which case parentStack will include a reference to it's parent.


regionRequired

public java.lang.String getRegion();
  • Type: java.lang.String

The ALIYUN region into which this stack will be deployed (e.g. cn-beijing).

This value is resolved according to the following rules:

  1. The value provided to env.region when the stack is defined. This can either be a concrete region or the ALIYUN.REGION token.
  2. 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.


stackIdRequired

public java.lang.String getStackId();
  • Type: java.lang.String

The ID of the stack.


stackNameRequired

public java.lang.String getStackName();
  • Type: java.lang.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.


synthesizerRequired

public IStackSynthesizer getSynthesizer();

Synthesis method for this stack.


tagsRequired

public TagManager getTags();

Tags to be applied to the stack.


templateFileRequired

public java.lang.String getTemplateFile();
  • Type: java.lang.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.getTemplate().getJson();

templateOptionsRequired

public ITemplateOptions getTemplateOptions();

Options for ROS template (like version, description).


nestedStackParentOptional

public Stack getNestedStackParent();

If this is a nested stack, returns it's parent stack.


nestedStackResourceOptional

public RosResource getNestedStackResource();

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 getParentStack();

Returns the parent of a nested stack.


rolesOptional

public RamRoles getRoles();