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
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
|
# File 'lib/fog/aws/parsers/compute/describe_reserved_instances.rb', line 27
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
6
7
8
|
# File 'lib/fog/aws/parsers/compute/describe_reserved_instances.rb', line 6
def get_default_item
{'tagSet' => {}, 'recurringCharges' => {}}
end
|
#reset ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'lib/fog/aws/parsers/compute/describe_reserved_instances.rb', line 10
def reset
@context = []
@contexts = ['reservedInstancesSet', 'tagSet']
@reserved_instance = get_default_item
@response = { 'reservedInstancesSet' => [] }
@tag = {}
end
|
#start_element(name, attrs = []) ⇒ Object
20
21
22
23
24
25
|
# File 'lib/fog/aws/parsers/compute/describe_reserved_instances.rb', line 20
def start_element(name, attrs = [])
super
if @contexts.include?(name)
@context.push(name)
end
end
|