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



1328
1329
1330
# File 'lib/ec2/right_ec2.rb', line 1328

def reset
  @result = []
end

#tagend(name) ⇒ Object



1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
# File 'lib/ec2/right_ec2.rb', line 1303

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



1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
# File 'lib/ec2/right_ec2.rb', line 1288

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