Class: Jets::Resource::ChildStack::Authorizer

Inherits:
Base
  • Object
show all
Includes:
CommonParameters
Defined in:
lib/jets/resource/child_stack/authorizer.rb

Instance Method Summary collapse

Methods included from CommonParameters

#common_parameters

Methods inherited from Base

#outputs, #template_url

Methods inherited from Base

#replacements, #resource

Constructor Details

#initialize(s3_bucket, options = {}) ⇒ Authorizer

Returns a new instance of Authorizer.



5
6
7
8
# File 'lib/jets/resource/child_stack/authorizer.rb', line 5

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

Instance Method Details

#authorizer_logical_idObject

map the path to a camelized logical_id. IE: ProtectAuthorizer



30
31
32
33
34
# File 'lib/jets/resource/child_stack/authorizer.rb', line 30

def authorizer_logical_id
  regexp = Regexp.new(".*#{Jets.config.project_namespace}-authorizers-")
  authorizer_name = @path.sub(regexp, '').sub('.yml', '')
  authorizer_name.underscore.camelize
end

#definitionObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/jets/resource/child_stack/authorizer.rb', line 10

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

#parametersObject



23
24
25
26
27
# File 'lib/jets/resource/child_stack/authorizer.rb', line 23

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

#template_filenameObject



36
37
38
# File 'lib/jets/resource/child_stack/authorizer.rb', line 36

def template_filename
  @path
end