2010-07-23 00:52:27 -04:00
|
|
|
module Fog
|
|
|
|
module Parsers
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
module AWS
|
2010-07-23 00:52:27 -04:00
|
|
|
|
|
|
|
class StartStopInstances < Fog::Parsers::Base
|
|
|
|
|
|
|
|
def reset
|
|
|
|
@instance = { 'currentState' => {}, 'previousState' => {} }
|
|
|
|
@response = { 'instancesSet' => [] }
|
|
|
|
@state = nil
|
|
|
|
end
|
|
|
|
|
|
|
|
def start_element(name, attrs = [])
|
|
|
|
super
|
|
|
|
case name
|
|
|
|
when 'currentState', 'previousState'
|
|
|
|
@state = name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def end_element(name)
|
|
|
|
case name
|
|
|
|
when 'code'
|
2011-05-12 16:15:13 -04:00
|
|
|
@instance[@state][name] = value.to_s
|
2010-07-23 00:52:27 -04:00
|
|
|
when 'instanceId'
|
2011-05-12 16:15:13 -04:00
|
|
|
@instance[name] = value
|
2010-07-23 00:52:27 -04:00
|
|
|
when 'item'
|
|
|
|
@response['instancesSet'] << @instance
|
|
|
|
@instance = { 'currentState' => {}, 'previousState' => {} }
|
|
|
|
when 'name'
|
2011-05-12 16:15:13 -04:00
|
|
|
@instance[@state][name] = value
|
2010-07-23 00:52:27 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|