2009-07-11 16:41:21 -04:00
|
|
|
module Fog
|
|
|
|
module Parsers
|
|
|
|
module AWS
|
|
|
|
module EC2
|
|
|
|
|
|
|
|
class DescribeVolumes < Fog::Parsers::Base
|
|
|
|
|
|
|
|
def reset
|
|
|
|
@attachment = {}
|
|
|
|
@in_attachment_set = false
|
2009-08-01 04:15:44 -04:00
|
|
|
@response = { 'volumeSet' => [] }
|
|
|
|
@volume = { 'attachmentSet' => [] }
|
2009-07-11 16:41:21 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def start_element(name, attrs = [])
|
2010-05-05 16:39:41 -04:00
|
|
|
super
|
2009-07-11 16:41:21 -04:00
|
|
|
if name == 'attachmentSet'
|
|
|
|
@in_attachment_set = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def end_element(name)
|
|
|
|
if @in_attachment_set
|
|
|
|
case name
|
|
|
|
when 'attachmentSet'
|
|
|
|
@in_attachment_set = false
|
|
|
|
when 'attachTime'
|
2009-08-01 04:15:44 -04:00
|
|
|
@attachment[name] = Time.parse(@value)
|
|
|
|
when 'device', 'instanceId', 'status', 'volumeId'
|
|
|
|
@attachment[name] = @value
|
2009-07-11 16:41:21 -04:00
|
|
|
when 'item'
|
2009-08-01 04:15:44 -04:00
|
|
|
@volume['attachmentSet'] << @attachment
|
2009-07-11 16:41:21 -04:00
|
|
|
@attachment = {}
|
|
|
|
end
|
|
|
|
else
|
|
|
|
case name
|
2009-08-01 04:15:44 -04:00
|
|
|
when 'availabilityZone', 'snapshotId', 'status', 'volumeId'
|
|
|
|
@volume[name] = @value
|
2009-07-11 16:41:21 -04:00
|
|
|
when 'createTime'
|
2009-08-01 04:15:44 -04:00
|
|
|
@volume[name] = Time.parse(@value)
|
2009-07-11 16:41:21 -04:00
|
|
|
when 'item'
|
2009-08-01 04:15:44 -04:00
|
|
|
@response['volumeSet'] << @volume
|
|
|
|
@volume = { 'attachmentSet' => [] }
|
2009-07-11 16:41:21 -04:00
|
|
|
when 'requestId'
|
2009-08-01 04:15:44 -04:00
|
|
|
@response[name] = @value
|
2009-07-11 16:41:21 -04:00
|
|
|
when 'size'
|
2009-08-01 04:15:44 -04:00
|
|
|
@volume[name] = @value.to_i
|
2009-07-11 16:41:21 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|