Class: Jets::Resource::ChildStack::ApiResource
- Defined in:
- lib/jets/resource/child_stack/api_resource.rb,
lib/jets/resource/child_stack/api_resource/page.rb
Defined Under Namespace
Classes: Page
Instance Method Summary collapse
- #api_resource_page(parameter) ⇒ Object
- #definition ⇒ Object
-
#initialize ⇒ ApiResource
constructor
A new instance of ApiResource.
- #parameters ⇒ Object
- #template_filename ⇒ Object
Methods inherited from Base
Methods inherited from Base
Constructor Details
#initialize ⇒ ApiResource
Returns a new instance of ApiResource.
8 9 10 11 |
# File 'lib/jets/resource/child_stack/api_resource.rb', line 8 def initialize(*) super @page = @options[:page] end |
Instance Method Details
#api_resource_page(parameter) ⇒ Object
46 47 48 |
# File 'lib/jets/resource/child_stack/api_resource.rb', line 46 def api_resource_page(parameter) Page.logical_id(parameter) end |
#definition ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/jets/resource/child_stack/api_resource.rb', line 13 def definition { "api_resources_#{@page}" => { type: "AWS::CloudFormation::Stack", # depends_on: "ApiGateway", # CloudFormation seems to be smart enough properties: { template_url: template_url, parameters: parameters, } } } end |
#parameters ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/jets/resource/child_stack/api_resource.rb', line 26 def parameters params = {} # Since dont have all the info required. # Read the template back to find the parameters required. # Actually might be easier to rationalize this approach. template_path = Jets::Naming.api_resources_template_path(@page) template = Jets::Cfn::BuiltTemplate.get(template_path) template['Parameters'].keys.each do |p| case p when "RestApi" params[p] = "!GetAtt ApiGateway.Outputs.RestApi" when "RootResourceId" params[p] = "!GetAtt ApiGateway.Outputs.RootResourceId" else params[p] = "!GetAtt #{api_resource_page(p)}.Outputs.#{p}" end end params end |