Class: RightAws::Ec2::QEc2DescribeSecurityGroupsParser

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

Overview


PARSERS: Security Groups

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



390
391
392
# File 'lib/ec2/right_ec2_security_groups.rb', line 390

def reset
  @result = []
end

#tagend(name) ⇒ Object



368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'lib/ec2/right_ec2_security_groups.rb', line 368

def tagend(name)
  case name
  when 'ownerId'          then @item[:owner_id]             = @text
  when 'groupDescription' then @item[:group_description]    = @text
  when 'ipProtocol'       then @ip_permission[:ip_protocol] = @text
  when 'fromPort'         then @ip_permission[:from_port]   = @text
  when 'toPort'           then @ip_permission[:to_port]     = @text
  when 'cidrIp'           then @ip_permission[:ip_ranges]  << @text
  when 'userId'           then @group[:user_id]             = @text
  when 'groupName'
    case
    when @xmlpath[/securityGroupInfo\/item$/] then @item[:group_name]  = @text
    when @xmlpath[/groups\/item$/]            then @group[:group_name] = @text
    end
  when 'item'
    case
    when @xmlpath[/groups$/]           then @ip_permission[:groups] << @group
    when @xmlpath[/ipPermissions$/]    then @item[:ip_permissions] << @ip_permission
    when @xmlpath[/securityGroupInfo$/]then @result << @item
    end
  end
end

#tagstart(name, attributes) ⇒ Object

:nodoc:



359
360
361
362
363
364
365
366
367
# File 'lib/ec2/right_ec2_security_groups.rb', line 359

def tagstart(name, attributes)
  if name == 'item'
    case
    when @xmlpath[/securityGroupInfo$/] then @item = { :ip_permissions => [] }
    when @xmlpath[/ipPermissions$/]     then @ip_permission = { :groups => [], :ip_ranges => [] }
    when @xmlpath[/groups$/]            then @group = {}
    end
  end
end