Class: RightAws::Ec2::QEc2DescribeInstancesParser

Inherits:
RightAWSParser show all
Defined in:
lib/ec2/right_ec2.rb

Instance Attribute Summary

Attributes inherited from RightAWSParser

#result, #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



1034
1035
1036
# File 'lib/ec2/right_ec2.rb', line 1034

def reset
  @result = []
end

#tagend(name) ⇒ Object



1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
# File 'lib/ec2/right_ec2.rb', line 1011

def tagend(name)
  case name 
    when 'reservationId' ; @reservation.reservationId   = @text
    when 'ownerId'       ; @reservation.ownerId         = @text
    when 'groupId'       ; @reservation.groupSet       << @text
    when 'instanceId'    ; @instance.instanceId         = @text
    when 'imageId'       ; @instance.imageId            = @text
    when 'dnsName'       ; @instance.dnsName            = @text
    when 'privateDnsName'; @instance.privateDnsName     = @text
    when 'reason'        ; @instance.reason             = @text
    when 'keyName'       ; @instance.keyName            = @text
    when 'amiLaunchIndex'; @instance.amiLaunchIndex     = @text
    when 'code'          ; @instance.instanceState.code = @text
    when 'name'          ; @instance.instanceState.name = @text
    when 'item'
      if @xmlpath=='DescribeInstancesResponse/reservationSet/item/instancesSet'
        @reservation.instancesSet << @instance
      elsif @xmlpath=='DescribeInstancesResponse/reservationSet'
        @result << @reservation
      end
    when 'productCode'   ; (@instance.productCodes ||= []) << @text
  end
end

#tagstart(name, attributes) ⇒ Object



992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
# File 'lib/ec2/right_ec2.rb', line 992

def tagstart(name, attributes)
  case name
    when 'item'
      if @xmlpath=='DescribeInstancesResponse/reservationSet'
        @reservation = QEc2DescribeInstancesType.new 
        @reservation.groupSet     = []
        @reservation.instancesSet = []
      elsif @xmlpath=='DescribeInstancesResponse/reservationSet/item/instancesSet'
        @instance = QEc2RunningInstancesItemType.new
          # the optional params (sometimes are missing and we dont want them to be nil) 
        @instance.reason         = ''
        @instance.dnsName        = ''
        @instance.privateDnsName = ''
        @instance.amiLaunchIndex = ''
        @instance.keyName        = ''
        @instance.instanceState  = QEc2InstanceStateType.new
      end
   end
end