class CfnDsl::ResourceDefinition

Automatically apply resource tag standard to supported resources (if supplied)

Public Class Methods

new() click to toggle source
# File lib/monkey-patches/cfndsl_patch.rb, line 75
def initialize
  apply_tag_standard
end

Private Instance Methods

apply_tag_standard() click to toggle source
# File lib/monkey-patches/cfndsl_patch.rb, line 81
def apply_tag_standard
  return unless defined? external_parameters[:TagStandard]
  return unless external_parameters[:TagStandard].is_a?(Hash)

  apply_tags(external_parameters[:TagStandard]) if defined? self.Tag
  apply_tags_map(external_parameters[:TagStandard]) if HAS_MAPPED_TAGS.include? self.class.to_s
end
apply_tags(tags) click to toggle source
# File lib/monkey-patches/cfndsl_patch.rb, line 89
def apply_tags(tags)
  tags.each do |tag_name, props|
    send(:Tag) do
      Key tag_name.to_s
      Value Ref(props['LogicalName'] || tag_name)
      PropagateAtLaunch true if HAS_PROPAGATABLE_TAGS.include? self.class.to_s
    end
  end
end
apply_tags_map(tags) click to toggle source
# File lib/monkey-patches/cfndsl_patch.rb, line 99
def apply_tags_map(tags)
  tag_map = {}
  tags.each do |tag_name, props|
    tag_map[tag_name.to_s] = Ref(props['LogicalName'] || tag_name)
  end
  Tags tag_map
end