Class CfnInclude
Construct to import an existing CloudFormation template file into a CDK application.
Inherited Members
Namespace: Amazon.CDK.CloudFormation.Include
Assembly: Amazon.CDK.CloudFormation.Include.dll
Syntax (csharp)
public class CfnInclude : CfnElement, IConstruct, IDependable
Syntax (vb)
Public Class CfnInclude
Inherits CfnElement
Implements IConstruct, IDependable
Remarks
All resources defined in the template file can be retrieved by calling the {@link getResource} method. Any modifications made on the returned resource objects will be reflected in the resulting CDK template.
ExampleMetadata: infused
Examples
var cfnTemplate = new CfnInclude(this, "Template", new CfnIncludeProps {
TemplateFile = "my-template.json"
});
Synopsis
Constructors
CfnInclude(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CfnInclude(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
CfnInclude(Construct, String, ICfnIncludeProps) |
Methods
GetCondition(String) | Returns the CfnCondition object from the 'Conditions' section of the CloudFormation template with the given name. |
GetHook(String) | Returns the CfnHook object from the 'Hooks' section of the included CloudFormation template with the given logical ID. |
GetMapping(String) | Returns the CfnMapping object from the 'Mappings' section of the included template. |
GetNestedStack(String) | Returns a loaded NestedStack with name logicalId. |
GetOutput(String) | Returns the CfnOutput object from the 'Outputs' section of the included template. |
GetParameter(String) | Returns the CfnParameter object from the 'Parameters' section of the included template. |
GetResource(String) | Returns the low-level CfnResource from the template with the given logical ID. |
GetRule(String) | Returns the CfnRule object from the 'Rules' section of the CloudFormation template with the given name. |
LoadNestedStack(String, ICfnIncludeProps) | Includes a template for a child stack inside of this parent template. |
Constructors
CfnInclude(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CfnInclude(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CfnInclude(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CfnInclude(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
CfnInclude(Construct, String, ICfnIncludeProps)
public CfnInclude(Construct scope, string id, ICfnIncludeProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props ICfnIncludeProps
Methods
GetCondition(String)
Returns the CfnCondition object from the 'Conditions' section of the CloudFormation template with the given name.
public virtual CfnCondition GetCondition(string conditionName)
Parameters
- conditionName System.String
the name of the Condition in the CloudFormation template file.
Returns
Remarks
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.
GetHook(String)
Returns the CfnHook object from the 'Hooks' section of the included CloudFormation template with the given logical ID.
public virtual CfnHook GetHook(string hookLogicalId)
Parameters
- hookLogicalId System.String
the logical ID of the Hook in the included CloudFormation template's 'Hooks' section.
Returns
Remarks
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.
GetMapping(String)
Returns the CfnMapping object from the 'Mappings' section of the included template.
public virtual CfnMapping GetMapping(string mappingName)
Parameters
- mappingName System.String
the name of the Mapping in the template to retrieve.
Returns
Remarks
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.
GetNestedStack(String)
Returns a loaded NestedStack with name logicalId.
public virtual IIncludedNestedStack GetNestedStack(string logicalId)
Parameters
- logicalId System.String
the ID of the stack to retrieve, as it appears in the template.
Returns
Remarks
For a nested stack to be returned by this method, it must be specified either in the {@link CfnIncludeProps.loadNestedStacks} property, or through the {@link loadNestedStack} method.
GetOutput(String)
Returns the CfnOutput object from the 'Outputs' section of the included template.
public virtual CfnOutput GetOutput(string logicalId)
Parameters
- logicalId System.String
the name of the output to retrieve.
Returns
Remarks
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.
GetParameter(String)
Returns the CfnParameter object from the 'Parameters' section of the included template.
public virtual CfnParameter GetParameter(string parameterName)
Parameters
- parameterName System.String
the name of the parameter to retrieve.
Returns
Remarks
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.
GetResource(String)
Returns the low-level CfnResource from the template with the given logical ID.
public virtual CfnResource GetResource(string logicalId)
Parameters
- logicalId System.String
the logical ID of the resource in the CloudFormation template file.
Returns
Remarks
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.
GetRule(String)
Returns the CfnRule object from the 'Rules' section of the CloudFormation template with the given name.
public virtual CfnRule GetRule(string ruleName)
Parameters
- ruleName System.String
the name of the Rule in the CloudFormation template.
Returns
Remarks
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.
LoadNestedStack(String, ICfnIncludeProps)
Includes a template for a child stack inside of this parent template.
public virtual IIncludedNestedStack LoadNestedStack(string logicalId, ICfnIncludeProps nestedStackProps)
Parameters
- logicalId System.String
the ID of the stack to retrieve, as it appears in the template.
- nestedStackProps ICfnIncludeProps
the properties of the included child Stack.
Returns
the same {@link IncludedNestedStack} object that {@link getNestedStack} returns for this logical ID
Remarks
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 {@link CfnIncludeProps.loadNestedStacks} property on object construction.