You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::EC2::NetworkAcl

Inherits:
Resources::Resource show all
Defined in:
(unknown)

Instance Attribute Summary collapse

Attributes inherited from Resources::Resource

#client, #identifiers

Instance Method Summary collapse

Methods inherited from Resources::Resource

add_data_attribute, add_identifier, #data, data_attributes, #data_loaded?, identifiers, #load, #wait_until

Methods included from Resources::OperationMethods

#add_batch_operation, #add_operation, #batch_operation, #batch_operation_names, #batch_operations, #operation, #operation_names, #operations

Constructor Details

#initialize(id, options = {}) ⇒ Object #initialize(options = {}) ⇒ Object

Overloads:

  • #initialize(id, options = {}) ⇒ Object

    Parameters:

    • id (String)

    Options Hash (options):

    • :client (Client)

      When `:client is not given, the options hash is used to construct a new Client object.

  • #initialize(options = {}) ⇒ Object

    Options Hash (options):

    • :id (required, String)
    • :client (Client)

      When `:client is not given, the options hash is used to construct a new Client object.

Instance Attribute Details

#associationsArray<Types::NetworkAclAssociation> (readonly)

Any associations between the network ACL and one or more subnets

Returns:

#entriesArray<Types::NetworkAclEntry> (readonly)

One or more entries (rules) in the network ACL.

Returns:

#idString (readonly)

Returns:

  • (String)

#is_defaultBoolean (readonly)

Indicates whether this is the default network ACL for the VPC.

Returns:

  • (Boolean)

    Indicates whether this is the default network ACL for the VPC.

#network_acl_idString (readonly)

The ID of the network ACL.

Returns:

  • (String)

    The ID of the network ACL.

#owner_idString (readonly)

The ID of the AWS account that owns the network ACL.

Returns:

  • (String)

    The ID of the AWS account that owns the network ACL.

#tagsArray<Types::Tag> (readonly)

Any tags assigned to the network ACL.

Returns:

  • (Array<Types::Tag>)

    Any tags assigned to the network ACL.

#vpc_idString (readonly)

The ID of the VPC for the network ACL.

Returns:

  • (String)

    The ID of the VPC for the network ACL.

Instance Method Details

#create_entry(options = {}) ⇒ Struct

Creates an entry (a rule) in a network ACL with the specified rule number. Each network ACL has a set of numbered ingress rules and a separate set of numbered egress rules. When determining whether a packet should be allowed in or out of a subnet associated with the ACL, we process the entries in the ACL according to the rule numbers, in ascending order. Each network ACL has a set of ingress rules and a separate set of egress rules.

We recommend that you leave room between the rule numbers (for example, 100, 110, 120, ...), and not number them one right after the other (for example, 101, 102, 103, ...). This makes it easier to add a rule between existing ones without having to renumber the rules.

After you add an entry, you can't modify it; you must either replace it, or create an entry and delete the old one.

For more information about network ACLs, see Network ACLs in the Amazon Virtual Private Cloud User Guide.

Examples:

Request syntax example with placeholder values


networkacl.create_entry({
  cidr_block: "String",
  dry_run: false,
  egress: false, # required
  icmp_type_code: {
    code: 1,
    type: 1,
  },
  ipv_6_cidr_block: "String",
  port_range: {
    from: 1,
    to: 1,
  },
  protocol: "String", # required
  rule_action: "allow", # required, accepts allow, deny
  rule_number: 1, # required
})

Options Hash (options):

  • :cidr_block (String)

    The IPv4 network range to allow or deny, in CIDR notation (for example 172.16.0.0/24). We modify the specified CIDR block to its canonical form; for example, if you specify 100.68.0.18/18, we modify it to 100.68.0.0/18.

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :egress (required, Boolean)

    Indicates whether this is an egress rule (rule is applied to traffic leaving the subnet).

  • :icmp_type_code (Types::IcmpTypeCode)

    ICMP protocol: The ICMP or ICMPv6 type and code. Required if specifying protocol 1 (ICMP) or protocol 58 (ICMPv6) with an IPv6 CIDR block.

  • :ipv_6_cidr_block (String)

    The IPv6 network range to allow or deny, in CIDR notation (for example 2001:db8:1234:1a00::/64).

  • :port_range (Types::PortRange)

    TCP or UDP protocols: The range of ports the rule applies to. Required if specifying protocol 6 (TCP) or 17 (UDP).

  • :protocol (required, String)

    The protocol number. A value of \"-1\" means all protocols. If you specify \"-1\" or a protocol number other than \"6\" (TCP), \"17\" (UDP), or \"1\" (ICMP), traffic on all ports is allowed, regardless of any ports or ICMP types or codes that you specify. If you specify protocol \"58\" (ICMPv6) and specify an IPv4 CIDR block, traffic for all ICMP types and codes allowed, regardless of any that you specify. If you specify protocol \"58\" (ICMPv6) and specify an IPv6 CIDR block, you must specify an ICMP type and code.

  • :rule_action (required, String)

    Indicates whether to allow or deny the traffic that matches the rule.

  • :rule_number (required, Integer)

    The rule number for the entry (for example, 100). ACL entries are processed in ascending order by rule number.

    Constraints: Positive integer from 1 to 32766. The range 32767 to 65535 is reserved for internal use.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#create_tags(options = {}) ⇒ Array<Tag>

Examples:

Request syntax example with placeholder values


networkacl.create_tags({
  dry_run: false,
  tags: [ # required
    {
      key: "String",
      value: "String",
    },
  ],
})

Basic usage

tags = networkacl.create_tags(options)
tags.map(&:value)
#=> ["tag-value", ...]

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :tags (required, Array<Types::Tag>)

    The tags. The value parameter is required, but if you don\'t want the tag to have a value, specify the parameter with no value, and we set the value to an empty string.

Returns:

See Also:

#delete(options = {}) ⇒ Struct

Deletes the specified network ACL. You can't delete the ACL if it's associated with any subnets. You can't delete the default network ACL.

Examples:

Request syntax example with placeholder values


networkacl.delete({
  dry_run: false,
})

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_entry(options = {}) ⇒ Struct

Deletes the specified ingress or egress entry (rule) from the specified network ACL.

Examples:

Request syntax example with placeholder values


networkacl.delete_entry({
  dry_run: false,
  egress: false, # required
  rule_number: 1, # required
})

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :egress (required, Boolean)

    Indicates whether the rule is an egress rule.

  • :rule_number (required, Integer)

    The rule number of the entry to delete.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_tags(options = {}) ⇒ Array<Tag>

Examples:

Request syntax example with placeholder values


networkacl.delete_tags({
  dry_run: false,
  tags: [
    {
      key: "String",
      value: "String",
    },
  ],
})

Basic usage

tags = networkacl.delete_tags(options)
tags.map(&:value)
#=> ["tag-value", ...]

Options Hash (options):

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :tags (Array<Types::Tag>)

    The tags to delete. Specify a tag key and an optional tag value to delete specific tags. If you specify a tag key without a tag value, we delete any tag with this key regardless of its value. If you specify a tag key with an empty string as the tag value, we delete the tag only if its value is an empty string.

    If you omit this parameter, we delete all user-defined tags for the specified resources. We do not delete AWS-generated tags (tags that have the aws: prefix).

Returns:

See Also:

#replace_association(options = {}) ⇒ Types::ReplaceNetworkAclAssociationResult

Changes which network ACL a subnet is associated with. By default when you create a subnet, it's automatically associated with the default network ACL. For more information, see Network ACLs in the Amazon Virtual Private Cloud User Guide.

This is an idempotent operation.

Examples:

Request syntax example with placeholder values


networkacl.replace_association({
  association_id: "NetworkAclAssociationId", # required
  dry_run: false,
})

Options Hash (options):

  • :association_id (required, String)

    The ID of the current association between the original network ACL and the subnet.

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Returns:

See Also:

#replace_entry(options = {}) ⇒ Struct

Replaces an entry (rule) in a network ACL. For more information, see Network ACLs in the Amazon Virtual Private Cloud User Guide.

Examples:

Request syntax example with placeholder values


networkacl.replace_entry({
  cidr_block: "String",
  dry_run: false,
  egress: false, # required
  icmp_type_code: {
    code: 1,
    type: 1,
  },
  ipv_6_cidr_block: "String",
  port_range: {
    from: 1,
    to: 1,
  },
  protocol: "String", # required
  rule_action: "allow", # required, accepts allow, deny
  rule_number: 1, # required
})

Options Hash (options):

  • :cidr_block (String)

    The IPv4 network range to allow or deny, in CIDR notation (for example 172.16.0.0/24).

  • :dry_run (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • :egress (required, Boolean)

    Indicates whether to replace the egress rule.

    Default: If no value is specified, we replace the ingress rule.

  • :icmp_type_code (Types::IcmpTypeCode)

    ICMP protocol: The ICMP or ICMPv6 type and code. Required if specifying protocol 1 (ICMP) or protocol 58 (ICMPv6) with an IPv6 CIDR block.

  • :ipv_6_cidr_block (String)

    The IPv6 network range to allow or deny, in CIDR notation (for example 2001:bd8:1234:1a00::/64).

  • :port_range (Types::PortRange)

    TCP or UDP protocols: The range of ports the rule applies to. Required if specifying protocol 6 (TCP) or 17 (UDP).

  • :protocol (required, String)

    The protocol number. A value of \"-1\" means all protocols. If you specify \"-1\" or a protocol number other than \"6\" (TCP), \"17\" (UDP), or \"1\" (ICMP), traffic on all ports is allowed, regardless of any ports or ICMP types or codes that you specify. If you specify protocol \"58\" (ICMPv6) and specify an IPv4 CIDR block, traffic for all ICMP types and codes allowed, regardless of any that you specify. If you specify protocol \"58\" (ICMPv6) and specify an IPv6 CIDR block, you must specify an ICMP type and code.

  • :rule_action (required, String)

    Indicates whether to allow or deny the traffic that matches the rule.

  • :rule_number (required, Integer)

    The rule number of the entry to replace.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#vpcVpc?

Returns: