Class: RightAws::Ec2::QEc2DescribeInstancesParser

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

Overview

:nodoc:

Constant Summary

Constants inherited from RightAWSParser

RightAWSParser::DEFAULT_XML_LIBRARY

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



1069
1070
1071
# File 'lib/ec2/right_ec2.rb', line 1069

def reset
  @result = []
end

#tagend(name) ⇒ Object



1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
# File 'lib/ec2/right_ec2.rb', line 1044

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
    when 'instanceType'  ; @instance.instanceType = @text
	  when 'launchTime'    ; @instance.launchTime = @text
  end
end

#tagstart(name, attributes) ⇒ Object



1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
# File 'lib/ec2/right_ec2.rb', line 1025

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