class AWS::EC2::NetworkACL::Entry

Represents a single entry (rule) for an EC2 network ACL.

def allow?

Returns:
  • (Boolean) - Returns true if traffic matching this rule
def allow?
  @action == :allow
end

def delete

Returns:
  • (nil) -
def delete
  network_acl.delete_entry(egress? ? :egress : :ingress, rule_number)
end

def deny?

Returns:
  • (Boolean) - Returns true if traffic matching this rule
def deny?
  @action == :deny
end

def egress?

Returns:
  • (Boolean) - Returns true if the rule is applied to traffic
def egress?
  @egress
end

def ingress?

Returns:
  • (Boolean) - Returns true if the rule is applied to traffic
def ingress?
  @ingress
end

def initialize network_acl, details

def initialize network_acl, details
  @network_acl = network_acl
  @rule_number = details[:rule_number]
  @protocol = details[:protocol].to_i
  @action = details[:rule_action].to_sym
  @egress = details[:egress]
  @ingress = !@egress
  @cidr_block = details[:cidr_block]
  if type_code = details[:icmp_type_code]
    @icmp_type = type_code[:type]
    @icmp_code = type_code[:code]
  end
  if range = details[:port_range]
    @port_range = (range[:from]..range[:to])
  end
end

def replace options = {}

Returns:
  • (nil) -

Options Hash: (**options)
  • :icmp_type (Integer) -- For the ICMP protocol,
  • :icmp_code (Integer) -- For the ICMP protocol, the
  • :port_range (Range) -- A numeric range
  • :egress (Boolean) --
  • :cidr_block (required, String) -- The CIDR range to
  • :protocol (required, Integer) -- IP protocol the rule
  • :rule_action (required, :allow, :deny) -- Whether to

Parameters:
  • options (Hash) --
def replace options = {}
  network_acl.replace_entry(options.merge(:rule_number => rule_number))
end