Class: Jets::Cfn::TemplateMappers::ApiGatewayDeploymentMapper

Inherits:
ChildMapper
  • Object
show all
Defined in:
lib/jets/cfn/template_mappers/api_gateway_deployment_mapper.rb

Constant Summary collapse

@@timestamp =
nil

Instance Attribute Summary

Attributes inherited from ChildMapper

#path

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ChildMapper

#initialize, #template_url

Constructor Details

This class inherits a constructor from Jets::Cfn::TemplateMappers::ChildMapper

Class Method Details

.logical_idObject

Returns: “ApiGatewayDeployment



35
36
37
# File 'lib/jets/cfn/template_mappers/api_gateway_deployment_mapper.rb', line 35

def self.logical_id
  "ApiGatewayDeployment#{timestamp}"
end

.stage_nameObject



44
45
46
# File 'lib/jets/cfn/template_mappers/api_gateway_deployment_mapper.rb', line 44

def self.stage_name
  [Jets.config.short_env, Jets.config.env_extra].compact.join('_').gsub('-','_') # Stage name only allows a-zA-Z0-9_
end

.timestampObject



40
41
42
# File 'lib/jets/cfn/template_mappers/api_gateway_deployment_mapper.rb', line 40

def self.timestamp
  @@timestamp ||= Time.now.strftime("%Y%m%d%H%M%S")
end

Instance Method Details

#depends_onObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/jets/cfn/template_mappers/api_gateway_deployment_mapper.rb', line 22

def depends_on
  expression = "#{Jets::Naming.template_path_prefix}-*_controller*"
  controller_logical_ids = []
  Dir.glob(expression).each do |path|
    next unless File.file?(path)
    # @s3_bucket is available from the inherited ChildMapper class
    map = ChildMapper.new(path, @s3_bucket)
    controller_logical_ids << map.logical_id
  end
  controller_logical_ids
end

#logical_idObject



3
4
5
# File 'lib/jets/cfn/template_mappers/api_gateway_deployment_mapper.rb', line 3

def logical_id
  self.class.logical_id
end

#parametersObject



16
17
18
19
20
# File 'lib/jets/cfn/template_mappers/api_gateway_deployment_mapper.rb', line 16

def parameters
  {
    RestApi: "!GetAtt ApiGateway.Outputs.RestApi"
  }
end

#stage_nameObject

stage_name: stag, stag-1, stag-2, etc



12
13
14
# File 'lib/jets/cfn/template_mappers/api_gateway_deployment_mapper.rb', line 12

def stage_name
  self.class.stage_name
end

#timestampObject



7
8
9
# File 'lib/jets/cfn/template_mappers/api_gateway_deployment_mapper.rb', line 7

def timestamp
  self.class.timestamp
end