Class: Jets::Cfn::Builder::Api::Resources

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

Instance Method Summary collapse

Methods inherited from Paged

build_pages, #initialize, pages_class

Methods inherited from Base

#initialize

Methods included from AwsServices

#apigateway, #aws_lambda, #aws_options, #cfn, #dynamodb, #logs, #s3, #s3_resource, #sns, #sqs, #sts

Methods included from AwsServices::StackStatus

#lookup, #stack_exists?, #stack_in_progress?

Methods included from AwsServices::GlobalMemoist

included

Methods included from Interface

#add_description, #add_output, #add_outputs, #add_parameter, #add_parameters, #add_resource, #add_resources, #add_template_resource, #build, #build?, #template, #text, #write

Methods included from Util::Camelize

#camelize

Constructor Details

This class inherits a constructor from Jets::Cfn::Builder::Api::Paged

Instance Method Details

#add_gateway_resourcesObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/jets/cfn/builder/api/resources.rb', line 18

def add_gateway_resources
  @items.each do |path|
    # IE: resource = Jets::Cfn::Resource::ApiGateway::Resource.new(path)
    next if path == '/' || path == '' # skip root path
    resource = api_gateway_resource_class.new(path)
    add_resource(resource)
    add_outputs(resource.outputs)

    parent_path = resource.parent_path_parameter
    add_parameter(parent_path) unless part_of_template?(parent_path)
  end
end

#add_rest_api_parameterObject



14
15
16
# File 'lib/jets/cfn/builder/api/resources.rb', line 14

def add_rest_api_parameter
  add_parameter(:RestApi)
end

#api_gateway_resource_classObject

interface method



32
33
34
# File 'lib/jets/cfn/builder/api/resources.rb', line 32

def api_gateway_resource_class
  Jets::Cfn::Resource::ApiGateway::Resource
end

#composeObject

interface method



4
5
6
7
# File 'lib/jets/cfn/builder/api/resources.rb', line 4

def compose
  add_gateway_resources
  add_rest_api_parameter
end

#part_of_template?(parent_path) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/jets/cfn/builder/api/resources.rb', line 36

def part_of_template?(parent_path)
  @template[:Resources].key?(parent_path)
end

#template_pathObject

interface method



10
11
12
# File 'lib/jets/cfn/builder/api/resources.rb', line 10

def template_path
  Jets::Names.api_resources_template_path(@page_number)
end