Module: AWSCDK::ICfnConditionExpression
- Includes:
- IResolvable
- Included in:
- CfnCondition, ICfnRuleConditionExpression
- Defined in:
- i_cfn_condition_expression.rb
Overview
Represents a CloudFormation element that can be used within a Condition.
You can use intrinsic functions, such as Fn.conditionIf,
Fn.conditionEquals, and Fn.conditionNot, to conditionally create
stack resources. These conditions are evaluated based on input parameters
that you declare when you create or update a stack. After you define all your
conditions, you can associate them with resources or resource properties in
the Resources and Outputs sections of a template.
You define all conditions in the Conditions section of a template except for
Fn.conditionIf conditions. You can use the Fn.conditionIf condition
in the metadata attribute, update policy attribute, and property values in
the Resources section and Outputs sections of a template.
You might use conditions when you want to reuse a template that can create resources in different contexts, such as a test environment versus a production environment. In your template, you can add an EnvironmentType input parameter, which accepts either prod or test as inputs. For the production environment, you might include Amazon EC2 instances with certain capabilities; however, for the test environment, you want to use less capabilities to save costs. With conditions, you can define which resources are created and how they're configured for each environment type.
You can use to_string when you wish to embed a condition expression
in a property value that accepts a string. For example:
AWSCDK::SQS::Queue.new(self, "MyQueue", {
queue_name: AWSCDK::Fn.condition_if("Condition", "Hello", "World").to_string,
})
Class Method Summary collapse
Instance Method Summary collapse
-
#creation_stack ⇒ Array<String>
deprecated
Deprecated.
creationStack has been deprecated for low usefulness and cost to capture
-
#resolve(context) ⇒ Object
Produce the Token's value at resolution time.
-
#to_string ⇒ String
Return a string representation of this resolvable object.
-
#type_hint ⇒ AWSCDK::ResolutionTypeHint?
The type that this token will likely resolve to.
Class Method Details
.jsii_overridable_methods ⇒ Object
74 75 76 77 78 79 80 81 |
# File 'i_cfn_condition_expression.rb', line 74 def self.jsii_overridable_methods { :creation_stack => { kind: :property, name: "creationStack", is_optional: false }, :type_hint => { kind: :property, name: "typeHint", is_optional: true }, :resolve => { kind: :method, name: "resolve", is_optional: false }, :to_string => { kind: :method, name: "toString", is_optional: false }, } end |
Instance Method Details
#creation_stack ⇒ Array<String>
creationStack has been deprecated for low usefulness and cost to capture
The creation stack of this resolvable which will be appended to errors thrown during resolution.
This may return an array with a single informational element indicating how to get this property populated, if it was skipped for performance reasons.
45 46 47 |
# File 'i_cfn_condition_expression.rb', line 45 def creation_stack() jsii_get_property("creationStack") end |
#resolve(context) ⇒ Object
Produce the Token's value at resolution time.
60 61 62 63 |
# File 'i_cfn_condition_expression.rb', line 60 def resolve(context) Jsii::Type.check_type(context, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5JUmVzb2x2ZUNvbnRleHQifQ==")), "context") jsii_call_method("resolve", [context]) end |
#to_string ⇒ String
Return a string representation of this resolvable object.
Returns a reversible string representation.
70 71 72 |
# File 'i_cfn_condition_expression.rb', line 70 def to_string() jsii_call_method("toString", []) end |
#type_hint ⇒ AWSCDK::ResolutionTypeHint?
The type that this token will likely resolve to.
52 53 54 |
# File 'i_cfn_condition_expression.rb', line 52 def type_hint() jsii_get_property("typeHint") end |