Class CfnCondition

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnCondition
All Implemented Interfaces:
ICfnConditionExpression, IResolvable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)", date="2024-10-04T00:39:26.519Z") @Stability(Stable) public class CfnCondition extends CfnElement implements ICfnConditionExpression, IResolvable
Represents a CloudFormation condition, for resources which must be conditionally created and the determination must be made at deploy time.

Example:

 CfnBucket rawBucket = CfnBucket.Builder.create(this, "Bucket").build();
 // -or-
 CfnBucket rawBucketAlt = (CfnBucket)myBucket.getNode().getDefaultChild();
 // then
 rawBucket.getCfnOptions().getCondition() = CfnCondition.Builder.create(this, "EnableBucket").build();
 rawBucket.getCfnOptions().getMetadata() = Map.of(
         "metadataKey", "MetadataValue");
 
  • Constructor Details

    • CfnCondition

      protected CfnCondition(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnCondition

      protected CfnCondition(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnCondition

      @Stability(Stable) public CfnCondition(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable CfnConditionProps props)
      Build a new condition.

      The condition must be constructed with a condition token, that the condition is based on.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props -
    • CfnCondition

      @Stability(Stable) public CfnCondition(@NotNull software.constructs.Construct scope, @NotNull String id)
      Build a new condition.

      The condition must be constructed with a condition token, that the condition is based on.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
  • Method Details

    • resolve

      @Stability(Stable) @NotNull public Object resolve(@NotNull IResolveContext _context)
      Synthesizes the condition.

      Specified by:
      resolve in interface IResolvable
      Parameters:
      _context - This parameter is required.
    • getExpression

      @Stability(Stable) @Nullable public ICfnConditionExpression getExpression()
      The condition statement.
    • setExpression

      @Stability(Stable) public void setExpression(@Nullable ICfnConditionExpression value)
      The condition statement.