StackProps
Initializer
import com.aliyun.ros.cdk.core.StackProps;
StackProps.builder()
// .description(java.lang.String)
// .enableResourcePropertyConstraint(java.lang.Boolean)
// .env(Environment)
// .metadata(java.util.Map<java.lang.String, java.lang.Object>)
// .stackName(java.lang.String)
// .synthesizer(IStackSynthesizer)
// .tags(java.util.Map<java.lang.String, java.lang.String>)
// .version(java.lang.String)
.build();
Properties
Name | Type | Description |
---|---|---|
description |
java.lang.String |
A description of the stack. |
enableResourcePropertyConstraint |
java.lang.Boolean |
No description. |
env |
Environment |
The ALIYUN environment (account/region) where this stack will be deployed. |
metadata |
java.util.Map |
No description. |
stackName |
java.lang.String |
Name to deploy the stack with. |
synthesizer |
IStackSynthesizer |
Synthesis method to use while deploying this stack. |
tags |
java.util.Map |
Stack tags that will be applied to all the taggable resources and the stack itself. |
version |
java.lang.String |
No description. |
description
Optional
public java.lang.String getDescription();
- Type: java.lang.String
- Default: No description.
A description of the stack.
enableResourcePropertyConstraint
Optional
public java.lang.Boolean getEnableResourcePropertyConstraint();
- Type: java.lang.Boolean
env
Optional
public Environment getEnv();
- Type: Environment
- Default: The environment of the containing
Stage
if available, otherwise create the stack will be environment-agnostic.
The ALIYUN environment (account/region) where this stack will be deployed.
Set the region
/account
fields of env
to either a concrete value to
select the indicated environment (recommended for production stacks), or to
the values of environment variables
CDK_DEFAULT_REGION
/CDK_DEFAULT_ACCOUNT
to let the target environment
depend on the ALIYUN credentials/configuration that the CDK CLI is executed
under (recommended for development stacks).
If the Stack
is instantiated inside a Stage
, any undefined
region
/account
fields from env
will default to the same field on the
encompassing Stage
, if configured there.
If either region
or account
are not set nor inherited from Stage
, the
Stack will be considered "environment-agnostic"". Environment-agnostic
stacks can be deployed to any environment but may not be able to take
advantage of all features of the CDK.
Example
// Example automatically generated from non-compiling source. May contain errors.
// Use a concrete account and region to deploy this stack to:
// `.account` and `.region` will simply return these values.
// Use a concrete account and region to deploy this stack to:
// `.account` and `.region` will simply return these values.
Stack.Builder.create(app, "Stack1")
.env(Map.of(
"account", "123456789012",
"region", "cn-hangzhou"))
.build();
// Use the CLI's current credentials to determine the target environment:
// `.account` and `.region` will reflect the account+region the CLI
// is configured to use (based on the user CLI credentials)
// Use the CLI's current credentials to determine the target environment:
// `.account` and `.region` will reflect the account+region the CLI
// is configured to use (based on the user CLI credentials)
Stack.Builder.create(app, "Stack2")
.env(Map.of(
"account", process.getEnv().getCDK_DEFAULT_ACCOUNT(),
"region", process.getEnv().getCDK_DEFAULT_REGION()))
.build();
// Define multiple stacks stage associated with an environment
Object myStage = Stage.Builder.create(app, "MyStage")
.env(Map.of(
"account", "123456789012",
"region", "cn-hangzhou"))
.build();
// both of these stacks will use the stage's account/region:
// `.account` and `.region` will resolve to the concrete values as above
// both of these stacks will use the stage's account/region:
// `.account` and `.region` will resolve to the concrete values as above
new MyStack(myStage, "Stack1");
new YourStack(myStage, "Stack2");
// Define an environment-agnostic stack:
// `.account` and `.region` will resolve to `{ "Ref": "ALIYUN::AccountId" }` and `{ "Ref": "ALIYUN::Region" }` respectively.
// which will only resolve to actual values by ROS during deployment.
// Define an environment-agnostic stack:
// `.account` and `.region` will resolve to `{ "Ref": "ALIYUN::AccountId" }` and `{ "Ref": "ALIYUN::Region" }` respectively.
// which will only resolve to actual values by ROS during deployment.
new MyStack(app, "Stack1");
metadata
Optional
public java.util.Map<java.lang.String, java.lang.Object> getMetadata();
- Type: java.util.Map
stackName
Optional
public java.lang.String getStackName();
- Type: java.lang.String
- Default: Derived from construct path.
Name to deploy the stack with.
synthesizer
Optional
public IStackSynthesizer getSynthesizer();
- Type: IStackSynthesizer
- Default:
DefaultStackSynthesizer
Synthesis method to use while deploying this stack.
tags
Optional
public java.util.Map<java.lang.String, java.lang.String> getTags();
- Type: java.util.Map
- Default: {}
Stack tags that will be applied to all the taggable resources and the stack itself.
version
Optional
public java.lang.String getVersion();
- Type: java.lang.String