Class: AWSCDK::CloudFormationInclude::CfnIncludeProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cloud_formation_include/cfn_include_props.rb

Overview

Construction properties of CfnInclude.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template_file:, allow_cyclical_references: nil, dehydrated_resources: nil, load_nested_stacks: nil, parameters: nil, preserve_logical_ids: nil) ⇒ CfnIncludeProps

Returns a new instance of CfnIncludeProps.

Parameters:

  • template_file (String)

    Path to the template file.

  • allow_cyclical_references (Boolean, nil) (defaults to: nil)

    Specifies whether to allow cyclical references, effectively disregarding safeguards meant to avoid undeployable templates.

  • dehydrated_resources (Array<String>, nil) (defaults to: nil)

    Specifies a list of LogicalIDs for resources that will be included in the CDK Stack, but will not be parsed and converted to CDK types.

  • load_nested_stacks (Hash{String => AWSCDK::CloudFormationInclude::CfnIncludeProps}, nil) (defaults to: nil)

    Specifies the template files that define nested stacks that should be included.

  • parameters (Hash{String => Object}, nil) (defaults to: nil)

    Specifies parameters to be replaced by the values in this mapping.

  • preserve_logical_ids (Boolean, nil) (defaults to: nil)

    Whether the resources should have the same logical IDs in the resulting CDK template as they did in the original CloudFormation template file.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'cloud_formation_include/cfn_include_props.rb', line 13

def initialize(template_file:, allow_cyclical_references: nil, dehydrated_resources: nil, load_nested_stacks: nil, parameters: nil, preserve_logical_ids: nil)
  @template_file = template_file
  Jsii::Type.check_type(@template_file, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "templateFile")
  @allow_cyclical_references = allow_cyclical_references
  Jsii::Type.check_type(@allow_cyclical_references, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "allowCyclicalReferences") unless @allow_cyclical_references.nil?
  @dehydrated_resources = dehydrated_resources
  Jsii::Type.check_type(@dehydrated_resources, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "dehydratedResources") unless @dehydrated_resources.nil?
  @load_nested_stacks = load_nested_stacks.is_a?(Hash) ? load_nested_stacks.transform_values { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CloudFormationInclude::CfnIncludeProps.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : load_nested_stacks
  Jsii::Type.check_type(@load_nested_stacks, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmNsb3VkZm9ybWF0aW9uX2luY2x1ZGUuQ2ZuSW5jbHVkZVByb3BzIn0sImtpbmQiOiJtYXAifX0=")), "loadNestedStacks") unless @load_nested_stacks.nil?
  @parameters = parameters
  Jsii::Type.check_type(@parameters, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImFueSJ9LCJraW5kIjoibWFwIn19")), "parameters") unless @parameters.nil?
  @preserve_logical_ids = preserve_logical_ids
  Jsii::Type.check_type(@preserve_logical_ids, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "preserveLogicalIds") unless @preserve_logical_ids.nil?
end

Instance Attribute Details

#allow_cyclical_referencesBoolean? (readonly)

Note:

Default: - will throw an error on detecting any cyclical references

Specifies whether to allow cyclical references, effectively disregarding safeguards meant to avoid undeployable templates.

This should only be set to true in the case of templates utilizing cloud transforms (e.g. SAM) that after processing the transform will no longer contain any circular references.

Returns:

  • (Boolean, nil)


41
42
43
# File 'cloud_formation_include/cfn_include_props.rb', line 41

def allow_cyclical_references
  @allow_cyclical_references
end

#dehydrated_resourcesArray<String>? (readonly)

Note:

Default: - All resources are hydrated

Specifies a list of LogicalIDs for resources that will be included in the CDK Stack, but will not be parsed and converted to CDK types.

This allows you to use CFN templates that rely on Intrinsic placement that cfn-include would otherwise reject, such as non-primitive values in resource update policies.

Returns:

  • (Array<String>, nil)


50
51
52
# File 'cloud_formation_include/cfn_include_props.rb', line 50

def dehydrated_resources
  @dehydrated_resources
end

#load_nested_stacksHash{String => AWSCDK::CloudFormationInclude::CfnIncludeProps}? (readonly)

Note:

Default: - no nested stacks will be included

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 CfnInclude.getNestedStack method (but will still be accessible from the 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.

Returns:

  • (Hash{String => AWSCDK::CloudFormationInclude::CfnIncludeProps}, nil)


63
64
65
# File 'cloud_formation_include/cfn_include_props.rb', line 63

def load_nested_stacks
  @load_nested_stacks
end

#parametersHash{String => Object}? (readonly)

Note:

Default: - parameters will retain their original definitions

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.

If you are importing a parameter from a live stack, we cannot know the value of that parameter. You will need to supply a value for your parameters, else the default value will be used.

Returns:

  • (Hash{String => Object}, nil)


76
77
78
# File 'cloud_formation_include/cfn_include_props.rb', line 76

def parameters
  @parameters
end

#preserve_logical_idsBoolean? (readonly)

Note:

Default: true

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 CfnInclude.getResource and related methods always uses the original logical ID of the resource/element, as specified in the template file.

Returns:

  • (Boolean, nil)


88
89
90
# File 'cloud_formation_include/cfn_include_props.rb', line 88

def preserve_logical_ids
  @preserve_logical_ids
end

#template_fileString (readonly)

Path to the template file.

Both JSON and YAML template formats are supported.

Returns:

  • (String)


33
34
35
# File 'cloud_formation_include/cfn_include_props.rb', line 33

def template_file
  @template_file
end

Class Method Details

.jsii_propertiesObject



90
91
92
93
94
95
96
97
98
99
# File 'cloud_formation_include/cfn_include_props.rb', line 90

def self.jsii_properties
  {
    :template_file => "templateFile",
    :allow_cyclical_references => "allowCyclicalReferences",
    :dehydrated_resources => "dehydratedResources",
    :load_nested_stacks => "loadNestedStacks",
    :parameters => "parameters",
    :preserve_logical_ids => "preserveLogicalIds",
  }
end

Instance Method Details

#to_jsiiObject



101
102
103
104
105
106
107
108
109
110
111
112
# File 'cloud_formation_include/cfn_include_props.rb', line 101

def to_jsii
  result = {}
  result.merge!({
    "templateFile" => @template_file,
    "allowCyclicalReferences" => @allow_cyclical_references,
    "dehydratedResources" => @dehydrated_resources,
    "loadNestedStacks" => @load_nested_stacks,
    "parameters" => @parameters,
    "preserveLogicalIds" => @preserve_logical_ids,
  })
  result.compact
end