Class: RightAws::Ec2::QEc2DescribeSecurityGroupsParser

Inherits:
RightAWSParser
  • Object
show all
Defined in:
lib/ec2/right_ec2_security_groups.rb

Overview

:nodoc:

Constant Summary

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



490
491
492
# File 'lib/ec2/right_ec2_security_groups.rb', line 490

def reset
  @result = []
end

#tagend(name) ⇒ Object



464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
# File 'lib/ec2/right_ec2_security_groups.rb', line 464

def tagend(name)
  case name
  when 'ownerId'          then @item[:owner_id]          = @text
  when 'groupDescription' then @item[:group_description] = @text
  when 'vpcId'            then @item[:vpc_id]            = @text
  else
    case full_tag_name
    when %r{securityGroupInfo/item/groupName$}                  then @item[:group_name]      = @text
    when %r{securityGroupInfo/item/groupId$}                    then @item[:group_id]        = @text
    # ipPermission[Egress]
    when %r{ipPermissions(Egress)?/item/ipProtocol$}            then @ip_perm[:ip_protocol]  = @text
    when %r{ipPermissions(Egress)?/item/fromPort$}              then @ip_perm[:from_port]    = @text
    when %r{ipPermissions(Egress)?/item/toPort$}                then @ip_perm[:to_port]      = @text
    when %r{ipPermissions(Egress)?/item/ipRanges/item/cidrIp$}  then @ip_perm[:ip_ranges]   << @text
    # ipPermissions[Egress]/Groups
    when %r{ipPermissions(Egress)?/item/groups/item/groupName$} then @group[:group_name]     = @text
    when %r{ipPermissions(Egress)?/item/groups/item/groupId$}   then @group[:group_id]       = @text
    when %r{ipPermissions(Egress)?/item/groups/item/userId$}    then @group[:user_id]        = @text
    # Sets
    when %r{ipPermissions(Egress)?/item/groups/item$}           then @ip_perm[:groups]      << @group
    when %r{ipPermissions/item$}                                then @item[:ip_permissions] << @ip_perm
    when %r{ipPermissionsEgress/item$}                          then @item[:ip_permissions] << @ip_perm
    when %r{securityGroupInfo/item$}                            then @result                << @item
    end
  end
end

#tagstart(name, attributes) ⇒ Object



454
455
456
457
458
459
460
461
462
463
# File 'lib/ec2/right_ec2_security_groups.rb', line 454

def tagstart(name, attributes)
  if name == 'item'
    case full_tag_name
    when %r{securityGroupInfo/item$}                  then @item    = { :ip_permissions => [] }
    when %r{ipPermissions/item$}                      then @ip_perm = { :groups => [], :ip_ranges => [], :direction => :ingress }
    when %r{ipPermissionsEgress/item$}                then @ip_perm = { :groups => [], :ip_ranges => [], :direction => :egress  }
    when %r{ipPermissions(Egress)?/item/groups/item$} then @group   = {}
    end
  end
end