class AWS::EC2::NetworkACL

def entry_options options

def entry_options options
  unless [true,false].include?(options[:egress])
    msg = "expected :egress option to be set to true or false"
    raise ArgumentError, msg
  end
  entry_opts = {}
  entry_opts[:network_acl_id] = network_acl_id
  entry_opts[:rule_number] = options[:rule_number]
  entry_opts[:protocol] = options[:protocol].to_s.downcase
  entry_opts[:rule_action] = options[:action].to_s
  entry_opts[:egress] = options[:egress] if options.key?(:egress)
  entry_opts[:cidr_block] = options[:cidr_block]
  if options[:icmp_code] or options[:icmp_type]
    entry_opts[:icmp_type_code] = {}
    entry_opts[:icmp_type_code][:type] = options[:icmp_type]
    entry_opts[:icmp_type_code][:code] = options[:icmp_code]
  end
  if options[:port_range]
    entry_opts[:port_range] = {}
    entry_opts[:port_range][:from] = options[:port_range].first
    entry_opts[:port_range][:to] = options[:port_range].last
  end
  entry_opts
end