Sha256: 17e2f8a676ac5b27341b99e4cf1ca6f896fa176f182d0af2281407c8c3ce9a8b

Contents?: true

Size: 909 Bytes

Versions: 96

Compression:

Stored size: 909 Bytes

Contents

# Implements:
#
#   template - uses @definition to build a CloudFormation template section
#
class Jets::Stack
  class Resource
    autoload :Dsl, "jets/stack/resource/dsl"
    include Definition

    def template
      template = camelize(standarize(@definition))
      template = replace_placeholers(template)
      template
    end

    # CloudFormation Resources reference: https://amzn.to/2NKg6ip
    def standarize(definition)
      Jets::Resource::Standardizer.new(definition).template
    end

    def replace_placeholers(template)
      attributes = template.values.first
      s3_key = attributes.dig('Properties','Code','S3Key')
      if s3_key == "code_s3_key_placeholder"
        checksum = Jets::Builders::Md5.checksums["stage/code"]
        code_zip = "code-#{checksum}.zip"
        attributes['Properties']['Code']['S3Key'] = "jets/code/#{code_zip}"
      end
      template
    end
  end
end

Version data entries

96 entries across 96 versions & 2 rubygems

Version Path
jets-1.8.2 lib/jets/stack/resource.rb
jets-1.8.1 lib/jets/stack/resource.rb
jets-1.8.0 lib/jets/stack/resource.rb
jets-1.7.2 lib/jets/stack/resource.rb
jets-1.7.1 lib/jets/stack/resource.rb
jets-1.7.0 lib/jets/stack/resource.rb
jets-fs-1.6.10 lib/jets/stack/resource.rb
jets-1.6.9 lib/jets/stack/resource.rb
jets-1.6.8 lib/jets/stack/resource.rb
jets-1.6.7 lib/jets/stack/resource.rb
jets-1.6.6 lib/jets/stack/resource.rb
jets-1.6.5 lib/jets/stack/resource.rb
jets-1.6.4 lib/jets/stack/resource.rb
jets-1.6.3 lib/jets/stack/resource.rb
jets-1.6.2 lib/jets/stack/resource.rb
jets-1.6.1 lib/jets/stack/resource.rb
jets-1.6.0 lib/jets/stack/resource.rb
jets-1.5.10 lib/jets/stack/resource.rb
jets-1.5.9 lib/jets/stack/resource.rb
jets-1.5.8 lib/jets/stack/resource.rb