Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CfnInclude_IsCfnElement ¶
func CfnInclude_IsCfnElement(x interface{}) *bool
Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).
Uses duck-typing instead of `instanceof` to allow stack elements from different versions of this library to be included in the same stack.
Returns: The construct as a stack element or undefined if it is not a stack element. Experimental.
func CfnInclude_IsConstruct ¶
func CfnInclude_IsConstruct(x interface{}) *bool
Return whether the given object is a Construct. Experimental.
func NewCfnInclude_Override ¶
func NewCfnInclude_Override(c CfnInclude, scope constructs.Construct, id *string, props *CfnIncludeProps)
Experimental.
Types ¶
type CfnInclude ¶
type CfnInclude interface { awscdk.CfnElement // Returns: the stack trace of the point where this Resource was created from, sourced // from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most // node +internal+ entries filtered. // Experimental. CreationStack() *[]*string // The logical ID for this CloudFormation stack element. // // The logical ID of the element // is calculated from the path of the resource node in the construct tree. // // To override this value, use `overrideLogicalId(newLogicalId)`. // // Returns: the logical ID as a stringified token. This value will only get // resolved during synthesis. // Experimental. LogicalId() *string // The construct tree node associated with this construct. // Experimental. Node() awscdk.ConstructNode // The stack in which this element is defined. // // CfnElements must be defined within a stack scope (directly or indirectly). // Experimental. Stack() awscdk.Stack // 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. // Experimental. GetCondition(conditionName *string) awscdk.CfnCondition // 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. // Experimental. GetHook(hookLogicalId *string) awscdk.CfnHook // 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. // Experimental. GetMapping(mappingName *string) awscdk.CfnMapping // Returns a loaded NestedStack with name logicalId. // // 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. // Experimental. GetNestedStack(logicalId *string) *IncludedNestedStack // 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. // Experimental. GetOutput(logicalId *string) awscdk.CfnOutput // 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. // Experimental. GetParameter(parameterName *string) awscdk.CfnParameter // 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. // Experimental. GetResource(logicalId *string) awscdk.CfnResource // 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. // Experimental. GetRule(ruleName *string) awscdk.CfnRule // 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 {@link CfnIncludeProps.loadNestedStacks} // property on object construction. // // Returns: the same {@link IncludedNestedStack} object that {@link getNestedStack} returns for this logical ID. // Experimental. LoadNestedStack(logicalId *string, nestedStackProps *CfnIncludeProps) *IncludedNestedStack // Perform final modifications before synthesis. // // This method can be implemented by derived constructs in order to perform // final changes before synthesis. prepare() will be called after child // constructs have been prepared. // // This is an advanced framework feature. Only use this if you // understand the implications. // Experimental. OnPrepare() // Allows this construct to emit artifacts into the cloud assembly during synthesis. // // This method is usually implemented by framework-level constructs such as `Stack` and `Asset` // as they participate in synthesizing the cloud assembly. // Experimental. OnSynthesize(session constructs.ISynthesisSession) // Validate the current construct. // // This method can be implemented by derived constructs in order to perform // validation logic. It is called on all constructs before synthesis. // // Returns: An array of validation error messages, or an empty array if the construct is valid. // Experimental. OnValidate() *[]*string // Overrides the auto-generated logical ID with a specific ID. // Experimental. OverrideLogicalId(newLogicalId *string) // Perform final modifications before synthesis. // // This method can be implemented by derived constructs in order to perform // final changes before synthesis. prepare() will be called after child // constructs have been prepared. // // This is an advanced framework feature. Only use this if you // understand the implications. // Experimental. Prepare() // Allows this construct to emit artifacts into the cloud assembly during synthesis. // // This method is usually implemented by framework-level constructs such as `Stack` and `Asset` // as they participate in synthesizing the cloud assembly. // Experimental. Synthesize(session awscdk.ISynthesisSession) // Returns a string representation of this construct. // Experimental. ToString() *string // Validate the current construct. // // This method can be implemented by derived constructs in order to perform // validation logic. It is called on all constructs before synthesis. // // Returns: An array of validation error messages, or an empty array if the construct is valid. // Experimental. Validate() *[]*string }
Construct to import an existing CloudFormation template file into a CDK application.
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.
Example:
cfnTemplate := cfn_inc.NewCfnInclude(this, jsii.String("Template"), &cfnIncludeProps{ templateFile: jsii.String("my-template.json"), })
Experimental.
func NewCfnInclude ¶
func NewCfnInclude(scope constructs.Construct, id *string, props *CfnIncludeProps) CfnInclude
Experimental.
type CfnIncludeProps ¶
type CfnIncludeProps struct { // Path to the template file. // // Both JSON and YAML template formats are supported. // Experimental. TemplateFile *string `field:"required" json:"templateFile" yaml:"templateFile"` // Specifies the template files that define nested stacks that should be included. // // If your template specifies a stack that isn't included here, it won't be created as a NestedStack // resource, and it won't be accessible from the {@link CfnInclude.getNestedStack} method // (but will still be accessible from the {@link CfnInclude.getResource} method). // // If you include a stack here with an ID that isn't in the template, // or is in the template but is not a nested stack, // template creation will fail and an error will be thrown. // Experimental. LoadNestedStacks *map[string]*CfnIncludeProps `field:"optional" json:"loadNestedStacks" yaml:"loadNestedStacks"` // Specifies parameters to be replaced by the values in this mapping. // // Any parameters in the template that aren't specified here will be left unmodified. // If you include a parameter here with an ID that isn't in the template, // template creation will fail and an error will be thrown. // Experimental. Parameters *map[string]interface{} `field:"optional" json:"parameters" yaml:"parameters"` // Whether the resources should have the same logical IDs in the resulting CDK template as they did in the original CloudFormation template file. // // If you're vending a Construct using an existing CloudFormation template, // make sure to pass this as `false`. // // **Note**: regardless of whether this option is true or false, // the {@link CfnInclude.getResource} and related methods always uses the original logical ID of the resource/element, // as specified in the template file. // Experimental. PreserveLogicalIds *bool `field:"optional" json:"preserveLogicalIds" yaml:"preserveLogicalIds"` }
Construction properties of {@link CfnInclude}.
Example:
parentTemplate := cfn_inc.NewCfnInclude(this, jsii.String("ParentStack"), &cfnIncludeProps{ templateFile: jsii.String("path/to/my-parent-template.json"), loadNestedStacks: map[string]*cfnIncludeProps{ "ChildStack": &cfnIncludeProps{ "templateFile": jsii.String("path/to/my-nested-template.json"), }, }, })
Experimental.
type IncludedNestedStack ¶
type IncludedNestedStack struct { // The CfnInclude that represents the template, which can be used to access Resources and other template elements. // Experimental. IncludedTemplate CfnInclude `field:"required" json:"includedTemplate" yaml:"includedTemplate"` // The NestedStack object which represents the scope of the template. // Experimental. Stack awscdk.NestedStack `field:"required" json:"stack" yaml:"stack"` }
The type returned from {@link CfnInclude.getNestedStack}. Contains both the NestedStack object and CfnInclude representations of the child stack.
Example:
var parentTemplate cfnInclude includedChildStack := parentTemplate.getNestedStack(jsii.String("ChildStack")) childStack := includedChildStack.stack childTemplate := includedChildStack.includedTemplate
Experimental.