Class: RightAws::Ec2::QEc2RunInstancesParser

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



1016
1017
1018
# File 'lib/ec2/right_ec2.rb', line 1016

def reset
  @result = []
end

#tagend(name) ⇒ Object



996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
# File 'lib/ec2/right_ec2.rb', line 996

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'          
      @reservation.instancesSet << @instance if @xmlpath == 'RunInstancesResponse/instancesSet'
    when 'RunInstancesResponse'; @result << @reservation
    when 'productCode'   ; (@instance.productCodes ||= []) << @text
  end
end

#tagstart(name, attributes) ⇒ Object



977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
# File 'lib/ec2/right_ec2.rb', line 977

def tagstart(name, attributes)
  case name
    when 'RunInstancesResponse'
      @reservation = QEc2DescribeInstancesType.new 
      @reservation.groupSet     = []
      @reservation.instancesSet = []
    when 'item'
      if @xmlpath == 'RunInstancesResponse/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