class AWS::EC2::SecurityGroup
def egress_opts args
def egress_opts args ensure_vpc do last = args.last if last.is_a?(Hash) and (last.key?(:protocol) or last.key?(:ports)) # hashes at the end of egress methods could be a hash intedned # to be a source, like: # # { :group_id => ..., :user_id => ... } # options = args.pop else options = {} end opts = {} opts[:ip_protocol] = [nil,:any, '-1'].include?(options[:protocol]) ? '-1' : options[:protocol].to_s.downcase if options[:ports] opts[:from_port] = Array(options[:ports]).first.to_i opts[:to_port] = Array(options[:ports]).last.to_i end ips, groups = parse_sources(args) opts[:ip_ranges] = ips unless ips.empty? opts[:user_id_group_pairs] = groups unless groups.empty? opts end end