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



962
963
964
# File 'lib/ec2/right_ec2.rb', line 962

def reset
  @result = []
end

#tagend(name) ⇒ Object



939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
# File 'lib/ec2/right_ec2.rb', line 939

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



920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
# File 'lib/ec2/right_ec2.rb', line 920

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