Class: Jets::Resource::ChildStack::ApiGateway

Inherits:
Base
  • Object
show all
Defined in:
lib/jets/resource/child_stack/api_gateway.rb

Instance Method Summary collapse

Methods inherited from Base

#template_url

Methods inherited from Base

#replacements, #resource

Constructor Details

#initialize(s3_bucket, options = {}) ⇒ ApiGateway

Returns a new instance of ApiGateway.



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

def initialize(s3_bucket, options={})
  super
  @page = options[:page]
  @page_range = options[:page_range]
  @required_parameters = options[:required_parameters]
end

Instance Method Details

#definitionObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/jets/resource/child_stack/api_gateway.rb', line 15

def definition

  properties = {
    template_url: template_url,
  }
  properties["parameters"] = parameters unless @page == 0

  Hash["api_gateway_#{@page}" => {
    type: "AWS::CloudFormation::Stack",
    properties: properties
  }]


end

#outputsObject



43
44
45
46
47
# File 'lib/jets/resource/child_stack/api_gateway.rb', line 43

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

#parametersObject



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/jets/resource/child_stack/api_gateway.rb', line 30

def parameters
  p = {
    RestApi: "!GetAtt ApiGateway0.Outputs.RestApi",
    RootResourceId: "!GetAtt ApiGateway0.Outputs.RootResourceId",
  } 

  @required_parameters.each do |required_parameter|
    p[required_parameter[:logical_id]] = "!GetAtt #{required_parameter[:location]}"
  end unless @required_parameters.nil?

  p
end

#template_filenameObject



49
50
51
# File 'lib/jets/resource/child_stack/api_gateway.rb', line 49

def template_filename
  "#{Jets.config.project_namespace}-api-gateway-#{@page}.yml"
end