2011-02-26 15:18:42 -05:00
|
|
|
module Fog
|
|
|
|
module Parsers
|
|
|
|
module AWS
|
|
|
|
module CloudFormation
|
|
|
|
|
|
|
|
class ValidateTemplate < Fog::Parsers::Base
|
|
|
|
|
2011-03-14 21:19:20 -04:00
|
|
|
def reset
|
|
|
|
@parameter = {}
|
|
|
|
@response = { 'Parameters' => [] }
|
|
|
|
end
|
|
|
|
|
|
|
|
def start_element(name, attrs = [])
|
|
|
|
super
|
|
|
|
case name
|
|
|
|
when 'Parameters'
|
|
|
|
@in_parameters = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-02-26 15:18:42 -05:00
|
|
|
def end_element(name)
|
|
|
|
case name
|
2011-03-14 21:19:20 -04:00
|
|
|
when 'DefaultValue', 'ParameterKey'
|
2011-05-12 16:15:13 -04:00
|
|
|
@parameter[name] = value
|
2011-03-14 21:19:20 -04:00
|
|
|
when 'Description'
|
|
|
|
if @in_parameters
|
2011-05-12 16:15:13 -04:00
|
|
|
@parameter[name] = value
|
2011-03-14 21:19:20 -04:00
|
|
|
else
|
2011-05-12 16:15:13 -04:00
|
|
|
@response[name] = value
|
2011-03-14 21:19:20 -04:00
|
|
|
end
|
|
|
|
when 'RequestId'
|
2011-05-12 16:15:13 -04:00
|
|
|
@response[name] = value
|
2011-03-14 21:19:20 -04:00
|
|
|
when 'member'
|
|
|
|
@response['Parameters'] << @parameter
|
|
|
|
@parameter = {}
|
|
|
|
when 'NoEcho'
|
2011-05-12 16:15:13 -04:00
|
|
|
case value
|
2011-03-14 21:19:20 -04:00
|
|
|
when 'false'
|
|
|
|
@parameter[name] = false
|
|
|
|
when 'true'
|
|
|
|
@parameter[name] = true
|
|
|
|
end
|
|
|
|
when 'Parameters'
|
|
|
|
@in_parameters = false
|
2011-02-26 15:18:42 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|