1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00
fog--fog-aws/lib/fog/aws/parsers/elasticache/engine_defaults_parser.rb
Josh Lane d48d376e9c initial import
* take the liberty of correcting Aws naming
2014-12-31 09:17:51 -08:00

58 lines
1.7 KiB
Ruby

module Fog
module Parsers
module AWS
module Elasticache
require 'fog/aws/parsers/elasticache/base'
class EngineDefaultsParser < Base
def reset
super
reset_engine_defaults
end
def reset_engine_defaults
@engine_defaults = {
'CacheNodeTypeSpecificParameters' => [],
'Parameters' => [],
}
end
def start_element(name, attrs = [])
case name
when 'CacheNodeTypeSpecificParameter', 'Parameter'
@parameter = {}
when 'CacheNodeTypeSpecificValues'
@parameter[name] = []
when 'CacheNodeTypeSpecificValue'
@node_specific_value = {}
else
super
end
end
def end_element(name)
case name
when 'CacheParameterGroupFamily'
@engine_defaults[name] = value
when 'CacheNodeTypeSpecificParameter', 'Parameter'
if not @parameter.empty?
@engine_defaults["#{name}s"] << @parameter
end
when 'AllowedValues', 'DataType', 'Description', 'IsModifiable',
'MinimumEngineVersion', 'ParameterName', 'ParameterValue', 'Source'
@parameter[name] = value
when 'CacheNodeType', 'Value'
@node_specific_value[name] = value
when 'CacheNodeTypeSpecificValue'
if not @node_specific_value.empty?
@parameter["#{name}s"] << @node_specific_value
end
else
super
end
end
end
end
end
end
end