Method: Sfn::MonkeyPatch::Stack#nesting_style

Defined in:
lib/sfn/monkey_patch/stack.rb

#nesting_styleSymbol, NilClass

Note:

in shallow nesting style, stack resources will not contain any direct values for parameters (which is what we are testing for)

Detect the nesting style in use by the stack

Returns:

  • (Symbol, NilClass)

    style of nesting (:shallow, :deep) or nil if no nesting detected



308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/sfn/monkey_patch/stack.rb', line 308

def nesting_style
  if self.respond_to?("nesting_style_#{api.provider}")
    self.send("nesting_style_#{api.provider}")
  else
    if nested?
      self.template["Resources"].find_all do |t_resource|
        t_resource["Type"] == self.api.class.const_get(:RESOURCE_MAPPING).key(self.class)
      end.detect do |t_resource|
        t_resource["Properties"].fetch("Parameters", {}).values.detect do |t_value|
          !t_value.is_a?(Hash)
        end
      end ? :deep : :shallow
    end
  end
end