Class: RightAws::Ec2::QEc2DescribeReservedInstancesParser

Inherits:
RightAWSParser
  • Object
show all
Defined in:
lib/ec2/right_ec2_reserved_instances.rb

Overview


PARSERS: ReservedInstances

Constant Summary

Constants inherited from RightAWSParser

RightAWSParser::DEFAULT_XML_LIBRARY

Instance Attribute Summary

Attributes inherited from RightAWSParser

#full_tag_name, #result, #tag, #xml_lib, #xmlpath

Instance Method Summary collapse

Methods inherited from RightAWSParser

#initialize, #method_missing, #parse, #tag_end, #tag_start, #tagtext, #text, xml_lib, xml_lib=

Constructor Details

This class inherits a constructor from RightAws::RightAWSParser

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RightAws::RightAWSParser

Instance Method Details

#resetObject



143
144
145
# File 'lib/ec2/right_ec2_reserved_instances.rb', line 143

def reset
  @result = []
end

#tagend(name) ⇒ Object



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/ec2/right_ec2_reserved_instances.rb', line 120

def tagend(name)
  case name
  when 'reservedInstancesId' then @item[:aws_id]                  = @text
  when 'instanceType'        then @item[:aws_instance_type]       = @text
  when 'availabilityZone'    then @item[:aws_availability_zone]   = @text
  when 'duration'            then @item[:aws_duration]            = @text.to_i
  when 'usagePrice'          then @item[:aws_usage_price]         = @text.to_f
  when 'fixedPrice'          then @item[:aws_fixed_price]         = @text.to_f
  when 'instanceCount'       then @item[:aws_instance_count]      = @text.to_i
  when 'productDescription'  then @item[:aws_product_description] = @text
  when 'state'               then @item[:aws_state]               = @text
  when 'start'               then @item[:aws_start]               = @text
  when 'instanceTenancy'     then @item[:instance_tenancy]        = @text
  when 'currencyCode'        then @item[:currency_code]           = @text
  else
    case full_tag_name
    when %r{/tagSet/item/key$}           then @aws_tag[:key]               = @text
    when %r{/tagSet/item/value$}         then @aws_tag[:value]             = @text
    when %r{/tagSet/item$}               then @item[:tags][@aws_tag[:key]] = @aws_tag[:value]
    when %r{/reservedInstancesSet/item$} then @result << @item
    end
  end
end

#tagstart(name, attributes) ⇒ Object

:nodoc:



114
115
116
117
118
119
# File 'lib/ec2/right_ec2_reserved_instances.rb', line 114

def tagstart(name, attributes)
  case full_tag_name
  when %r{/reservedInstancesSet/item$} then @item    = { :tags => {} }
  when %r{/tagSet/item$}                        then @aws_tag = {}
  end
end