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



905
906
907
# File 'lib/ec2/right_ec2.rb', line 905

def reset
  @result = []
end

#tagend(name) ⇒ Object



880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
# File 'lib/ec2/right_ec2.rb', line 880

def tagend(name)
  case name
    when 'ownerId'          ; @group.ownerId   = @text
    when 'groupDescription' ; @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'       ; @perm.ipProtocol = @text
    when 'fromPort'         ; @perm.fromPort   = @text
    when 'toPort'           ; @perm.toPort     = @text
    when 'userId'           ; @sgroup.userId   = @text
    when 'cidrIp'           ; @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



865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
# File 'lib/ec2/right_ec2.rb', line 865

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