Class CfnInclude
- All Implemented Interfaces:
IConstruct
,IDependable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
All resources defined in the template file can be retrieved by calling the getResource(java.lang.String)
method.
Any modifications made on the returned resource objects will be reflected in the resulting CDK template.
Example:
CfnInclude cfnTemplate = CfnInclude.Builder.create(this, "Template") .templateFile("my-template.json") .build();
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
-
Constructor Summary
ModifierConstructorDescriptionprotected
CfnInclude
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnInclude
(software.amazon.jsii.JsiiObjectRef objRef) CfnInclude
(software.constructs.Construct scope, String id, CfnIncludeProps props) -
Method Summary
Modifier and TypeMethodDescriptiongetCondition
(String conditionName) Returns the CfnCondition object from the 'Conditions' section of the CloudFormation template with the given name.Returns the CfnHook object from the 'Hooks' section of the included CloudFormation template with the given logical ID.getMapping
(String mappingName) Returns the CfnMapping object from the 'Mappings' section of the included template.getNestedStack
(String logicalId) Returns a loaded NestedStack with name logicalId.Returns the CfnOutput object from the 'Outputs' section of the included template.getParameter
(String parameterName) Returns the CfnParameter object from the 'Parameters' section of the included template.getResource
(String logicalId) Returns the low-level CfnResource from the template with the given logical ID.Returns the CfnRule object from the 'Rules' section of the CloudFormation template with the given name.loadNestedStack
(String logicalId, CfnIncludeProps nestedStackProps) Includes a template for a child stack inside of this parent template.Methods inherited from class software.amazon.awscdk.core.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
Methods inherited from class software.constructs.Construct
toString
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
CfnInclude
protected CfnInclude(software.amazon.jsii.JsiiObjectRef objRef) -
CfnInclude
protected CfnInclude(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnInclude
@Stability(Stable) public CfnInclude(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnIncludeProps props) - Parameters:
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.
-
-
Method Details
-
getCondition
Returns the CfnCondition object from the 'Conditions' section of the CloudFormation template with the given name.Any modifications performed on that object will be reflected in the resulting CDK template.
If a Condition with the given name is not present in the template, throws an exception.
- Parameters:
conditionName
- the name of the Condition in the CloudFormation template file. This parameter is required.
-
getHook
Returns the CfnHook object from the 'Hooks' section of the included CloudFormation template with the given logical ID.Any modifications performed on the returned object will be reflected in the resulting CDK template.
If a Hook with the given logical ID is not present in the template, an exception will be thrown.
- Parameters:
hookLogicalId
- the logical ID of the Hook in the included CloudFormation template's 'Hooks' section. This parameter is required.
-
getMapping
Returns the CfnMapping object from the 'Mappings' section of the included template.Any modifications performed on that object will be reflected in the resulting CDK template.
If a Mapping with the given name is not present in the template, an exception will be thrown.
- Parameters:
mappingName
- the name of the Mapping in the template to retrieve. This parameter is required.
-
getNestedStack
Returns a loaded NestedStack with name logicalId.For a nested stack to be returned by this method, it must be specified either in the
CfnIncludeProps.loadNestedStacks
property, or through theloadNestedStack(java.lang.String,software.amazon.awscdk.cloudformation.include.CfnIncludeProps)
method.- Parameters:
logicalId
- the ID of the stack to retrieve, as it appears in the template. This parameter is required.
-
getOutput
Returns the CfnOutput object from the 'Outputs' section of the included template.Any modifications performed on that object will be reflected in the resulting CDK template.
If an Output with the given name is not present in the template, throws an exception.
- Parameters:
logicalId
- the name of the output to retrieve. This parameter is required.
-
getParameter
Returns the CfnParameter object from the 'Parameters' section of the included template.Any modifications performed on that object will be reflected in the resulting CDK template.
If a Parameter with the given name is not present in the template, throws an exception.
- Parameters:
parameterName
- the name of the parameter to retrieve. This parameter is required.
-
getResource
Returns the low-level CfnResource from the template with the given logical ID.Any modifications performed on that resource will be reflected in the resulting CDK template.
The returned object will be of the proper underlying class; you can always cast it to the correct type in your code:
// assume the template contains an AWS::S3::Bucket with logical ID 'Bucket' const cfnBucket = cfnTemplate.getResource('Bucket') as s3.CfnBucket; // cfnBucket is of type s3.CfnBucket
If the template does not contain a resource with the given logical ID, an exception will be thrown.
- Parameters:
logicalId
- the logical ID of the resource in the CloudFormation template file. This parameter is required.
-
getRule
Returns the CfnRule object from the 'Rules' section of the CloudFormation template with the given name.Any modifications performed on that object will be reflected in the resulting CDK template.
If a Rule with the given name is not present in the template, an exception will be thrown.
- Parameters:
ruleName
- the name of the Rule in the CloudFormation template. This parameter is required.
-
loadNestedStack
@Stability(Stable) @NotNull public IncludedNestedStack loadNestedStack(@NotNull String logicalId, @NotNull CfnIncludeProps nestedStackProps) Includes a template for a child stack inside of this parent template.A child with this logical ID must exist in the template, and be of type AWS::CloudFormation::Stack. This is equivalent to specifying the value in the
CfnIncludeProps.loadNestedStacks
property on object construction.- Parameters:
logicalId
- the ID of the stack to retrieve, as it appears in the template. This parameter is required.nestedStackProps
- the properties of the included child Stack. This parameter is required.- Returns:
- the same
IncludedNestedStack
object thatgetNestedStack(java.lang.String)
returns for this logical ID
-