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

#full_tag_name, #result, #tag, #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



550
551
552
# File 'lib/ec2/right_ec2.rb', line 550

def reset
  @result = []
end

#tagend(name) ⇒ Object



525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
# File 'lib/ec2/right_ec2.rb', line 525

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



510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
# File 'lib/ec2/right_ec2.rb', line 510

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