class CfnVpn::Compiler

Public Class Methods

new(name, config) click to toggle source
# File lib/cfnvpn/compiler.rb, line 7
def initialize(name, config)
  @name = name
  @config = config
end

Public Instance Methods

compile() click to toggle source
# 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