Class: CfnModel::Transforms::Serverless
- Inherits:
-
Object
- Object
- CfnModel::Transforms::Serverless
- Defined in:
- lib/cfn-model/transforms/serverless.rb
Overview
Handle transformation of model elements performed by the Serverless trasnform, see docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/transform-aws-serverless.html
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.instance ⇒ Object
20 21 22 23 |
# File 'lib/cfn-model/transforms/serverless.rb', line 20 def self.instance @instance ||= Serverless.new @instance end |
Instance Method Details
#perform_transform(cfn_hash) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/cfn-model/transforms/serverless.rb', line 9 def perform_transform(cfn_hash) with_line_numbers = false resources = cfn_hash['Resources'].clone resources.each do |resource_name, resource| next unless matching_resource_type?(resource['Type'], 'AWS::Serverless::Function') with_line_numbers = true if resource['Type'].is_a? Hash replace_serverless_function cfn_hash, resource_name, with_line_numbers end end |