Class: CfnVpn::Compiler

Inherits:
Object
  • Object
show all
Defined in:
lib/cfnvpn/compiler.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, config) ⇒ Compiler



7
8
9
10
# File 'lib/cfnvpn/compiler.rb', line 7

def initialize(name, config)
  @name = name
  @config = config
end

Instance Method Details

#compileObject



12
13
14
15
16
17
18
19
20
# File 'lib/cfnvpn/compiler.rb', line 12

def compile
  CfnVpn::Log.logger.debug "Compiling cloudformation"
  template = CfnVpn::Templates::Vpn.new()
  template.render(@name, @config)
  CfnVpn::Log.logger.debug "Validating cloudformation"
  valid = template.validate
  CfnVpn::Log.logger.debug "Clouformation Template\n\n#{JSON.parse(valid.to_json).to_yaml}"
  return JSON.parse(valid.to_json).to_yaml
end