2012-03-15 02:16:31 -04:00
|
|
|
module Fog
|
|
|
|
module Parsers
|
|
|
|
module Compute
|
|
|
|
module AWS
|
|
|
|
class DescribeVolumeStatus < Fog::Parsers::Base
|
|
|
|
def reset
|
2012-06-16 09:05:34 -04:00
|
|
|
@action_set = {}
|
|
|
|
@detail = {}
|
|
|
|
@event_set = {}
|
|
|
|
@volume_status = { 'details' => [] }
|
|
|
|
@volume = { 'actionsSet' => [], 'eventsSet' => [] }
|
2012-03-15 02:16:31 -04:00
|
|
|
@response = { 'volumeStatusSet' => [] }
|
|
|
|
end
|
|
|
|
|
|
|
|
def start_element(name, attrs=[])
|
|
|
|
super
|
|
|
|
case name
|
2012-06-16 09:05:34 -04:00
|
|
|
when 'actionsSet'
|
|
|
|
@in_actions_set = true
|
2012-03-15 02:16:31 -04:00
|
|
|
when 'details'
|
2012-06-16 09:05:34 -04:00
|
|
|
@in_details = true
|
2012-06-15 12:56:18 -04:00
|
|
|
when 'eventsSet'
|
2012-06-16 09:05:34 -04:00
|
|
|
@in_events_set = true
|
|
|
|
when 'volumeStatus'
|
|
|
|
@in_volume_status = true
|
2012-03-15 02:16:31 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def end_element(name)
|
2012-06-16 09:05:34 -04:00
|
|
|
if @in_actions_set
|
|
|
|
case name
|
|
|
|
when 'actionsSet'
|
|
|
|
@in_actions_set = false
|
|
|
|
when 'code', 'eventId', 'eventType', 'description'
|
|
|
|
@action_set[name] = value.strip
|
|
|
|
when 'item'
|
|
|
|
@volume['actionsSet'] << @action_set
|
|
|
|
@action_set = {}
|
|
|
|
end
|
|
|
|
elsif @in_details
|
|
|
|
case name
|
|
|
|
when 'details'
|
|
|
|
@in_details = false
|
|
|
|
when 'name', 'status'
|
|
|
|
@detail[name] = value
|
|
|
|
when 'item'
|
|
|
|
@volume_status['details'] << @detail
|
|
|
|
@detail = {}
|
|
|
|
end
|
|
|
|
elsif @in_events_set
|
|
|
|
case name
|
|
|
|
when 'eventsSet'
|
|
|
|
@in_events_set = false
|
|
|
|
when 'code', 'eventId', 'eventType', 'description'
|
|
|
|
@event_set[name] = value.strip
|
|
|
|
when 'notAfter', 'notBefore'
|
|
|
|
@event_set[name] = Time.parse(value)
|
|
|
|
when 'item'
|
|
|
|
@volume['eventsSet'] << @event_set
|
|
|
|
@event_set = {}
|
|
|
|
end
|
|
|
|
elsif @in_volume_status
|
|
|
|
case name
|
|
|
|
when 'volumeStatus'
|
|
|
|
@volume['volumeStatus'] = @volume_status
|
|
|
|
@volume_status = { 'details' => [] }
|
|
|
|
@in_volume_status = false
|
|
|
|
when 'status'
|
|
|
|
@volume_status[name] = value
|
|
|
|
end
|
|
|
|
else
|
|
|
|
case name
|
|
|
|
when 'volumeId', 'availabilityZone'
|
|
|
|
@volume[name] = value
|
|
|
|
when 'nextToken', 'requestId'
|
|
|
|
@response[name] = value
|
|
|
|
when 'item'
|
|
|
|
@response['volumeStatusSet'] << @volume
|
|
|
|
@volume = { 'actionsSet' => [], 'eventsSet' => [] }
|
2012-03-15 02:16:31 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|