Sha256: ae9f19870602a686413583b222e75c11daa08515b0cdfdc7fbafad5a3c05cb93

Contents?: true

Size: 867 Bytes

Versions: 15

Compression:

Stored size: 867 Bytes

Contents

module Jets::Cfn::Resource::Nested
  class Authorizer < Base
    def initialize(options={})
      super
      @path = options[:path]
    end

    def definition
      logical_id = authorizer_logical_id
      {
        logical_id => {
          Type: "AWS::CloudFormation::Stack",
          Properties: {
            TemplateURL: template_url,
            Parameters: parameters,
          }
        }
      }
    end

    def parameters
      params = Jets::Cfn::Params::Common.parameters
      params[:RestApi] = "!GetAtt ApiGateway.Outputs.RestApi"
      params
    end

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

Version data entries

15 entries across 15 versions & 1 rubygems

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