Class: Jets::Cfn::Resource::Nested::Base

Inherits:
Base
  • Object
show all
Defined in:
lib/jets/cfn/resource/nested/base.rb

Direct Known Subclasses

Api::Base, AppClass, Authorizer, OneController

Instance Method Summary collapse

Methods inherited from Base

#attributes, #logical_id, #parameters, #permission, #properties, #replacements, #replacer, #standarize, #template, truncate_id, #type

Methods included from Util::Camelize

#camelize

Constructor Details

#initialize(options = {}) ⇒ Base

Returns a new instance of Base.



8
9
10
# File 'lib/jets/cfn/resource/nested/base.rb', line 8

def initialize(options={})
  @options = options # not used yet
end

Instance Method Details

#outputsObject



12
13
14
15
16
# File 'lib/jets/cfn/resource/nested/base.rb', line 12

def outputs
  {
    logical_id => "!Ref #{logical_id}",
  }
end

#template_filenameObject

Examples:

api-gateway.yml
api-resources-1.yml
api-methods-1.yml
app-posts_controller.yml
shared-custom.yml


29
30
31
32
33
34
35
36
# File 'lib/jets/cfn/resource/nested/base.rb', line 29

def template_filename
  filename = if @path # AppClass, Authorizer, Shared
    @path.sub("#{Jets::Names.templates_folder}/", '').gsub('/','-').sub('.yml', '')
  else
      self.class.name.to_s.sub(/.*Nested::/,'').underscore.gsub('/','-').dasherize
    end
  [filename, @page_number].compact.join('-') + '.yml'
end

#template_urlObject



18
19
20
21
# File 'lib/jets/cfn/resource/nested/base.rb', line 18

def template_url
  checksum = Jets::Builders::Md5.checksums["stage/code"]
  "https://s3.amazonaws.com/#{Jets.s3_bucket}/jets/cfn-templates/shas/#{checksum}/#{template_filename}"
end