Class: Jets::Stack::Resource

Inherits:
Object
  • Object
show all
Includes:
Definition
Defined in:
lib/jets/stack/resource.rb,
lib/jets/stack/resource/dsl.rb

Defined Under Namespace

Modules: Dsl

Instance Method Summary collapse

Methods included from Definition

#camelize, #initialize, #register

Instance Method Details

#replace_placeholers(template) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/jets/stack/resource.rb', line 20

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

#standarize(definition) ⇒ Object

CloudFormation Resources reference: amzn.to/2NKg6ip



16
17
18
# File 'lib/jets/stack/resource.rb', line 16

def standarize(definition)
  Jets::Resource::Standardizer.new(definition).template
end

#templateObject



9
10
11
12
13
# File 'lib/jets/stack/resource.rb', line 9

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