Class: Fog::Parsers::Compute::AWS::DescribeReservedInstances
- Inherits:
-
Base
- Object
- Nokogiri::XML::SAX::Document
- Base
- Fog::Parsers::Compute::AWS::DescribeReservedInstances
show all
- Defined in:
- lib/fog/aws/parsers/compute/describe_reserved_instances.rb
Instance Attribute Summary
Attributes inherited from Base
#response
Instance Method Summary
collapse
Methods inherited from Base
#attr_value, #characters, #end_element_namespace, #initialize, #start_element_namespace, #value
Instance Method Details
#end_element(name) ⇒ Object
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
|
# File 'lib/fog/aws/parsers/compute/describe_reserved_instances.rb', line 29
def end_element(name)
case name
when 'availabilityZone', 'instanceType', 'productDescription', 'reservedInstancesId', 'state', 'offeringType'
@reserved_instance[name] = value
when 'duration', 'instanceCount'
@reserved_instance[name] = value.to_i
when 'fixedPrice', 'amount', 'usagePrice'
@reserved_instance[name] = value.to_f
when *@contexts
@context.pop
when 'item'
case @context.last
when 'reservedInstancesSet'
@response['reservedInstancesSet'] << @reserved_instance
@reserved_instance = get_default_item
when 'tagSet'
@reserved_instance['tagSet'][@tag['key']] = @tag['value']
@tag = {}
end
when 'key', 'value'
@tag[name] = value
when 'requestId'
@response[name] = value
when 'start','end'
@reserved_instance[name] = Time.parse(value)
end
end
|
#get_default_item ⇒ Object
8
9
10
|
# File 'lib/fog/aws/parsers/compute/describe_reserved_instances.rb', line 8
def get_default_item
{'tagSet' => {}, 'recurringCharges' => {}}
end
|
#reset ⇒ Object
12
13
14
15
16
17
18
19
20
|
# File 'lib/fog/aws/parsers/compute/describe_reserved_instances.rb', line 12
def reset
@context = []
@contexts = ['reservedInstancesSet', 'tagSet']
@reserved_instance = get_default_item
@response = { 'reservedInstancesSet' => [] }
@tag = {}
end
|
#start_element(name, attrs = []) ⇒ Object
22
23
24
25
26
27
|
# File 'lib/fog/aws/parsers/compute/describe_reserved_instances.rb', line 22
def start_element(name, attrs = [])
super
if @contexts.include?(name)
@context.push(name)
end
end
|