Class: Jets::Cfn::Params::Api::Resources

Inherits:
Base
  • Object
show all
Defined in:
lib/jets/cfn/params/api/resources.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, #load_template, #params

Constructor Details

This class inherits a constructor from Jets::Cfn::Params::Api::Base

Class Method Details

.stack_logical_id(parameter) ⇒ Object

IE: path: #Jets.build_root/templates/api-resources-1.yml“



23
24
25
# File 'lib/jets/cfn/params/api/resources.rb', line 23

def stack_logical_id(parameter)
  Jets::Cfn::Template.lookup_logical_id("api-resources", parameter)
end

Instance Method Details

#buildObject

interface method



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/jets/cfn/params/api/resources.rb', line 4

def build
  # For the nested ApiResources template defined in the parent template, we need
  # grab the parameters from the other paged ApiResources templates if not in
  # the current template.
  @template[:Parameters].keys.each do |key|
    key = key.to_sym
    case key.to_s
    when "RestApi"
      @params.merge!(key => "!GetAtt ApiGateway.Outputs.RestApi")
    when "RootResourceId"
      @params.merge!(key => "!GetAtt ApiGateway.Outputs.RootResourceId")
    else
      @params.merge!(key => "!GetAtt #{self.class.stack_logical_id(key)}.Outputs.#{key}")
    end
  end
end