Sha256: 015b05796f6ad3287d6f6dae85f9cf38e6136569409665539211461946129379
Contents?: true
Size: 1.22 KB
Versions: 6
Compression:
Stored size: 1.22 KB
Contents
module Jets::Cfn::Builders class ApiResourcesBuilder include Interface include Jets::AwsServices def initialize(options={}, paths=[], page) @options, @paths, @page = options, paths, page @template = ActiveSupport::HashWithIndifferentAccess.new(Resources: {}) end # compose is an interface method def compose return unless @options[:templates] || @options[:stack_type] != :minimal add_rest_api_parameter add_gateway_routes end # template_path is an interface method def template_path Jets::Naming.api_resources_template_path(@page) end def add_rest_api_parameter add_parameter("RestApi", Description: "RestApi") end def add_gateway_routes @paths.each do |path| homepage = path == '' next if homepage # handled by RootResourceId output already resource = Jets::Resource::ApiGateway::Resource.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 def part_of_template?(parent_path) @template["Resources"].key?(parent_path) end end end
Version data entries
6 entries across 6 versions & 1 rubygems