Sha256: f37effde5a8da09ba69427c74c3f49378ea56cfb9ff269356ba3da299a5f2c48

Contents?: true

Size: 1 KB

Versions: 15

Compression:

Stored size: 1 KB

Contents

module Jets::Cfn::Builder::Api
  class Resources < Paged
    # interface method
    def compose
      add_gateway_resources
      add_rest_api_parameter
    end

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

    def add_rest_api_parameter
      add_parameter(:RestApi)
    end

    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

    # interface method
    def api_gateway_resource_class
      Jets::Cfn::Resource::ApiGateway::Resource
    end

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
jets-5.0.13 lib/jets/cfn/builder/api/resources.rb
jets-5.0.12 lib/jets/cfn/builder/api/resources.rb
jets-5.0.11 lib/jets/cfn/builder/api/resources.rb
jets-5.0.10 lib/jets/cfn/builder/api/resources.rb
jets-5.0.9 lib/jets/cfn/builder/api/resources.rb
jets-5.0.8 lib/jets/cfn/builder/api/resources.rb
jets-5.0.7 lib/jets/cfn/builder/api/resources.rb
jets-5.0.6 lib/jets/cfn/builder/api/resources.rb
jets-5.0.5 lib/jets/cfn/builder/api/resources.rb
jets-5.0.4 lib/jets/cfn/builder/api/resources.rb
jets-5.0.3 lib/jets/cfn/builder/api/resources.rb
jets-5.0.2 lib/jets/cfn/builder/api/resources.rb
jets-5.0.1 lib/jets/cfn/builder/api/resources.rb
jets-5.0.0 lib/jets/cfn/builder/api/resources.rb
jets-5.0.0.beta1 lib/jets/cfn/builder/api/resources.rb