Class: RightAws::Ec2::QEc2DescribeSecurityGroupsParser

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



974
975
976
# File 'lib/ec2/right_ec2.rb', line 974

def reset
  @result = []
end

#tagend(name) ⇒ Object



949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
# File 'lib/ec2/right_ec2.rb', line 949

def tagend(name)
  case name
    when 'ownerId'          then @group.ownerId   = @text
    when 'groupDescription' then @group.groupDescription = @text
    when 'groupName'
      if @xmlpath=='DescribeSecurityGroupsResponse/securityGroupInfo/item'
        @group.groupName  = @text 
      elsif @xmlpath=='DescribeSecurityGroupsResponse/securityGroupInfo/item/ipPermissions/item/groups/item'
        @sgroup.groupName = @text 
      end
    when 'ipProtocol'       then @perm.ipProtocol = @text
    when 'fromPort'         then @perm.fromPort   = @text
    when 'toPort'           then @perm.toPort     = @text
    when 'userId'           then @sgroup.userId   = @text
    when 'cidrIp'           then @perm.ipRanges  << @text
    when 'item'
      if @xmlpath=='DescribeSecurityGroupsResponse/securityGroupInfo/item/ipPermissions/item/groups'
        @perm.groups << @sgroup
      elsif @xmlpath=='DescribeSecurityGroupsResponse/securityGroupInfo/item/ipPermissions'
        @group.ipPermissions << @perm
      elsif @xmlpath=='DescribeSecurityGroupsResponse/securityGroupInfo'
        @result << @group
      end
  end
end

#tagstart(name, attributes) ⇒ Object



934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
# File 'lib/ec2/right_ec2.rb', line 934

def tagstart(name, attributes)
  case name
    when 'item' 
      if @xmlpath=='DescribeSecurityGroupsResponse/securityGroupInfo'
        @group = QEc2SecurityGroupItemType.new 
        @group.ipPermissions = []
      elsif @xmlpath=='DescribeSecurityGroupsResponse/securityGroupInfo/item/ipPermissions'
        @perm = QEc2IpPermissionType.new
        @perm.ipRanges = []
        @perm.groups   = []
      elsif @xmlpath=='DescribeSecurityGroupsResponse/securityGroupInfo/item/ipPermissions/item/groups'
        @sgroup = QEc2UserIdGroupPairType.new
      end
  end
end