software.amazon.awscdk.integtests.alpha.IntegTestCaseStack Maven / Gradle / Ivy
Show all versions of cdk-integ-tests-alpha Show documentation
package software.amazon.awscdk.integtests.alpha;
/**
* (experimental) An integration test case stack. Allows the definition of test properties that should apply to this stack.
*
* This should be used if there are multiple stacks in the integration test
* and it is necessary to specify different test case option for each. Otherwise
* normal stacks should be added to IntegTest
*
* Example:
*
*
* App app;
* Stack stackUnderTest;
* IntegTestCaseStack testCaseWithAssets = IntegTestCaseStack.Builder.create(app, "TestCaseAssets")
* .diffAssets(true)
* .build();
* IntegTest.Builder.create(app, "Integ").testCases(List.of(stackUnderTest, testCaseWithAssets)).build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-19T18:12:09.687Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.integtests.alpha.$Module.class, fqn = "@aws-cdk/integ-tests-alpha.IntegTestCaseStack")
public class IntegTestCaseStack extends software.amazon.awscdk.Stack {
protected IntegTestCaseStack(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected IntegTestCaseStack(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
* @param props
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public IntegTestCaseStack(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.Nullable software.amazon.awscdk.integtests.alpha.IntegTestCaseStackProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), props });
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public IntegTestCaseStack(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required") });
}
/**
* (experimental) Returns whether the construct is a IntegTestCaseStack.
*
* @param x This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static @org.jetbrains.annotations.NotNull java.lang.Boolean isIntegTestCaseStack(final @org.jetbrains.annotations.NotNull java.lang.Object x) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.awscdk.integtests.alpha.IntegTestCaseStack.class, "isIntegTestCaseStack", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class), new Object[] { x });
}
/**
* (experimental) Make assertions on resources in this test case.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.integtests.alpha.IDeployAssert getAssertions() {
return software.amazon.jsii.Kernel.get(this, "assertions", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.integtests.alpha.IDeployAssert.class));
}
/**
* (experimental) A fluent builder for {@link software.amazon.awscdk.integtests.alpha.IntegTestCaseStack}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create(final software.constructs.Construct scope, final java.lang.String id) {
return new Builder(scope, id);
}
private final software.constructs.Construct scope;
private final java.lang.String id;
private software.amazon.awscdk.integtests.alpha.IntegTestCaseStackProps.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
}
/**
* List of CloudFormation resource types in this stack that can be destroyed as part of an update without failing the test.
*
* This list should only include resources that for this specific
* integration test we are sure will not cause errors or an outage if
* destroyed. For example, maybe we know that a new resource will be created
* first before the old resource is destroyed which prevents any outage.
*
* e.g. ['AWS::IAM::Role']
*
* Default: - do not allow destruction of any resources on update
*
* @return {@code this}
* @param allowDestroy List of CloudFormation resource types in this stack that can be destroyed as part of an update without failing the test. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder allowDestroy(final java.util.List allowDestroy) {
this.props().allowDestroy(allowDestroy);
return this;
}
/**
* Additional options to use for each CDK command.
*
* Default: - runner default options
*
* @return {@code this}
* @param cdkCommandOptions Additional options to use for each CDK command. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder cdkCommandOptions(final software.amazon.awscdk.cloud_assembly_schema.CdkCommands cdkCommandOptions) {
this.props().cdkCommandOptions(cdkCommandOptions);
return this;
}
/**
* Whether or not to include asset hashes in the diff Asset hashes can introduces a lot of unneccessary noise into tests, but there are some cases where asset hashes should be included.
*
* For example
* any tests involving custom resources or bundling
*
* Default: false
*
* @return {@code this}
* @param diffAssets Whether or not to include asset hashes in the diff Asset hashes can introduces a lot of unneccessary noise into tests, but there are some cases where asset hashes should be included. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder diffAssets(final java.lang.Boolean diffAssets) {
this.props().diffAssets(diffAssets);
return this;
}
/**
* Additional commands to run at predefined points in the test workflow.
*
* e.g. { postDeploy: ['yarn', 'test'] }
*
* Default: - no hooks
*
* @return {@code this}
* @param hooks Additional commands to run at predefined points in the test workflow. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder hooks(final software.amazon.awscdk.cloud_assembly_schema.Hooks hooks) {
this.props().hooks(hooks);
return this;
}
/**
* Limit deployment to these regions.
*
* Default: - can run in any region
*
* @return {@code this}
* @param regions Limit deployment to these regions. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder regions(final java.util.List regions) {
this.props().regions(regions);
return this;
}
/**
* Run update workflow on this test case This should only be set to false to test scenarios that are not possible to test as part of the update workflow.
*
* Default: true
*
* @return {@code this}
* @param stackUpdateWorkflow Run update workflow on this test case This should only be set to false to test scenarios that are not possible to test as part of the update workflow. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder stackUpdateWorkflow(final java.lang.Boolean stackUpdateWorkflow) {
this.props().stackUpdateWorkflow(stackUpdateWorkflow);
return this;
}
/**
* Include runtime versioning information in this Stack.
*
* Default: `analyticsReporting` setting of containing `App`, or value of
* 'aws:cdk:version-reporting' context key
*
* @return {@code this}
* @param analyticsReporting Include runtime versioning information in this Stack. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder analyticsReporting(final java.lang.Boolean analyticsReporting) {
this.props().analyticsReporting(analyticsReporting);
return this;
}
/**
* Enable this flag to allow native cross region stack references.
*
* Enabling this will create a CloudFormation custom resource
* in both the producing stack and consuming stack in order to perform the export/import
*
* This feature is currently experimental
*
* Default: false
*
* @return {@code this}
* @param crossRegionReferences Enable this flag to allow native cross region stack references. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder crossRegionReferences(final java.lang.Boolean crossRegionReferences) {
this.props().crossRegionReferences(crossRegionReferences);
return this;
}
/**
* A description of the stack.
*
* Default: - No description.
*
* @return {@code this}
* @param description A description of the stack. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder description(final java.lang.String description) {
this.props().description(description);
return this;
}
/**
* The AWS 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 AWS 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. For example, they will not be able to
* use environmental context lookups such as ec2.Vpc.fromLookup
and will not
* automatically translate Service Principals to the right format based on the
* environment's AWS partition, and other such enhancements.
*
* Default: - The environment of the containing `Stage` if available,
* otherwise create the stack will be environment-agnostic.
*
* Example:
*
*
* // 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(Environment.builder()
* .account("123456789012")
* .region("us-east-1")
* .build())
* .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(Environment.builder()
* .account(process.getEnv().getCDK_DEFAULT_ACCOUNT())
* .region(process.getEnv().getCDK_DEFAULT_REGION())
* .build())
* .build();
* // Define multiple stacks stage associated with an environment
* Stage myStage = Stage.Builder.create(app, "MyStage")
* .env(Environment.builder()
* .account("123456789012")
* .region("us-east-1")
* .build())
* .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": "AWS::AccountId" }` and `{ "Ref": "AWS::Region" }` respectively.
* // which will only resolve to actual values by CloudFormation during deployment.
* // Define an environment-agnostic stack:
* // `.account` and `.region` will resolve to `{ "Ref": "AWS::AccountId" }` and `{ "Ref": "AWS::Region" }` respectively.
* // which will only resolve to actual values by CloudFormation during deployment.
* new MyStack(app, "Stack1");
*
*
* @return {@code this}
* @param env The AWS environment (account/region) where this stack will be deployed. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder env(final software.amazon.awscdk.Environment env) {
this.props().env(env);
return this;
}
/**
* Options for applying a permissions boundary to all IAM Roles and Users created within this Stage.
*
* Default: - no permissions boundary is applied
*
* @return {@code this}
* @param permissionsBoundary Options for applying a permissions boundary to all IAM Roles and Users created within this Stage. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder permissionsBoundary(final software.amazon.awscdk.PermissionsBoundary permissionsBoundary) {
this.props().permissionsBoundary(permissionsBoundary);
return this;
}
/**
* Name to deploy the stack with.
*
* Default: - Derived from construct path.
*
* @return {@code this}
* @param stackName Name to deploy the stack with. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder stackName(final java.lang.String stackName) {
this.props().stackName(stackName);
return this;
}
/**
* Enable this flag to suppress indentation in generated CloudFormation templates.
*
* If not specified, the value of the @aws-cdk/core:suppressTemplateIndentation
* context key will be used. If that is not specified, then the
* default value false
will be used.
*
* Default: - the value of `@aws-cdk/core:suppressTemplateIndentation`, or `false` if that is not set.
*
* @return {@code this}
* @param suppressTemplateIndentation Enable this flag to suppress indentation in generated CloudFormation templates. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder suppressTemplateIndentation(final java.lang.Boolean suppressTemplateIndentation) {
this.props().suppressTemplateIndentation(suppressTemplateIndentation);
return this;
}
/**
* Synthesis method to use while deploying this stack.
*
* The Stack Synthesizer controls aspects of synthesis and deployment,
* like how assets are referenced and what IAM roles to use. For more
* information, see the README of the main CDK package.
*
* If not specified, the defaultStackSynthesizer
from App
will be used.
* If that is not specified, DefaultStackSynthesizer
is used if
* @aws-cdk/core:newStyleStackSynthesis
is set to true
or the CDK major
* version is v2. In CDK v1 LegacyStackSynthesizer
is the default if no
* other synthesizer is specified.
*
* Default: - The synthesizer specified on `App`, or `DefaultStackSynthesizer` otherwise.
*
* @return {@code this}
* @param synthesizer Synthesis method to use while deploying this stack. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder synthesizer(final software.amazon.awscdk.IStackSynthesizer synthesizer) {
this.props().synthesizer(synthesizer);
return this;
}
/**
* Stack tags that will be applied to all the taggable resources and the stack itself.
*
* Default: {}
*
* @return {@code this}
* @param tags Stack tags that will be applied to all the taggable resources and the stack itself. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder tags(final java.util.Map tags) {
this.props().tags(tags);
return this;
}
/**
* Whether to enable termination protection for this stack.
*
* Default: false
*
* @return {@code this}
* @param terminationProtection Whether to enable termination protection for this stack. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder terminationProtection(final java.lang.Boolean terminationProtection) {
this.props().terminationProtection(terminationProtection);
return this;
}
/**
* @return a newly built instance of {@link software.amazon.awscdk.integtests.alpha.IntegTestCaseStack}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public software.amazon.awscdk.integtests.alpha.IntegTestCaseStack build() {
return new software.amazon.awscdk.integtests.alpha.IntegTestCaseStack(
this.scope,
this.id,
this.props != null ? this.props.build() : null
);
}
private software.amazon.awscdk.integtests.alpha.IntegTestCaseStackProps.Builder props() {
if (this.props == null) {
this.props = new software.amazon.awscdk.integtests.alpha.IntegTestCaseStackProps.Builder();
}
return this.props;
}
}
}