Sha256: 69ccc15b4e82e37233c0f3ffa4b3555bffe62ae3b822e4e5f0aa0187b25d965d

Contents?: true

Size: 1 KB

Versions: 10

Compression:

Stored size: 1 KB

Contents

module Jets::Resource::ChildStack
  class Authorizer < Base
    include CommonParameters

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

    def definition
      logical_id = authorizer_logical_id
      {
        logical_id => {
          type: "AWS::CloudFormation::Stack",
          properties: {
            template_url: template_url,
            parameters: parameters,
          }
        }
      }
    end

    def parameters
      params = common_parameters
      params[:RestApi] = "!GetAtt ApiGateway.Outputs.RestApi"
      params
    end

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

    # map the path to a camelized logical_id. IE: ProtectAuthorizer
    def authorizer_logical_id
      regexp = Regexp.new(".*#{Jets.config.project_namespace}-authorizers-")
      authorizer_name = @path.sub(regexp, '').sub('.yml', '')
      authorizer_name.underscore.camelize
    end

    def template_filename
      @path
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
jets-2.3.3 lib/jets/resource/child_stack/authorizer.rb
jets-2.3.2 lib/jets/resource/child_stack/authorizer.rb
jets-2.3.1 lib/jets/resource/child_stack/authorizer.rb
jets-2.3.0 lib/jets/resource/child_stack/authorizer.rb
jets-2.2.5 lib/jets/resource/child_stack/authorizer.rb
jets-2.2.4 lib/jets/resource/child_stack/authorizer.rb
jets-2.2.3 lib/jets/resource/child_stack/authorizer.rb
jets-2.2.2 lib/jets/resource/child_stack/authorizer.rb
jets-2.2.1 lib/jets/resource/child_stack/authorizer.rb
jets-2.2.0 lib/jets/resource/child_stack/authorizer.rb