23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/fog/aws/parsers/ec2/describe_instances.rb', line 23
def end_element(name)
case name
when 'amiLaunchIndex'
@instance[name] = @value.to_i
when 'availabilityZone'
@instance['placement'] << @value
when 'code'
@instance['instanceState'][name] = @value
when 'dnsName', 'imageId', 'instanceId', 'instanceType', 'kernelId', 'keyName', 'privateDnsName', 'ramdiskId', 'reason'
@instance[name] = @value
when 'groupId'
@reservation['groupSet'] << @value
when 'groupSet'
@in_subset = false
when 'instancesSet'
@in_instances_set = false
when 'item'
if @in_instances_set
@reservation['instancesSet'] << @instance
@instance = { 'instanceState' => {}, 'monitoring' => {}, 'placement' => [], 'productCodes' => [] }
elsif !@in_subset
@response['reservationSet'] << @reservation
@reservation = { 'groupSet' => [], 'instancesSet' => [] }
end
when 'launchTime'
@instance[name] = Time.parse(@value)
when 'name'
@instance['instanceState'][name] = @value
when 'ownerId', 'reservationId'
@reservation[name] = @value
when 'requestId'
@response[name] = @value
when 'productCode'
@instance['productCodes'] << @value
when 'productCodes'
@in_subset = false
when 'state'
if @value == 'true'
@instance['monitoring'][name] = true
else
@instance['monitoring'][name] = false
end
end
end
|