Class: AWS::EC2::NetworkACL
- Inherits:
-
Resource
- Object
- Core::Resource
- Resource
- AWS::EC2::NetworkACL
- Includes:
- TaggedItem
- Defined in:
- lib/aws/ec2/network_acl.rb,
lib/aws/ec2/network_acl/entry.rb,
lib/aws/ec2/network_acl/association.rb
Overview
Represents a network ACL in EC2.
Defined Under Namespace
Classes: Association, Entry
Instance Attribute Summary collapse
-
#default ⇒ Boolean
(also: #default?)
readonly
Returns true if this is the default network ACL.
- #network_acl_id ⇒ String (also: #id) readonly
-
#vpc_id ⇒ String
readonly
The current value of vpc_id.
Instance Method Summary collapse
-
#associations ⇒ Array<NetworkACL::Association>
Returns an array of Association objects (association to subnets).
-
#create_entry(options = {}) ⇒ nil
Adds an entry to this network ACL.
-
#delete ⇒ nil
Deletes the current network ACL.
-
#delete_entry(egress_or_ingress, rule_number) ⇒ nil
Deletes an entry from this network ACL.
-
#entries ⇒ Array<NetworkACL::Entry>
Returns an array of all entries for this network ACL.
-
#initialize(network_acl_id, options = {}) ⇒ NetworkACL
constructor
A new instance of NetworkACL.
-
#replace_entry(options = {}) ⇒ nil
Replaces the network ACL entry with the given :rule_number.
-
#subnets ⇒ Array<Subnet>
Returns an array of subnets (Subnet) that currently use this network ACL.
-
#vpc ⇒ VPC
Returns the VPC this network ACL belongs to.
Methods included from TaggedItem
Constructor Details
#initialize(network_acl_id, options = {}) ⇒ NetworkACL
Returns a new instance of NetworkACL.
31 32 33 34 |
# File 'lib/aws/ec2/network_acl.rb', line 31 def initialize network_acl_id, = {} @network_acl_id = network_acl_id super end |
Instance Attribute Details
#default ⇒ Boolean (readonly) Also known as: default?
Returns true if this is the default network ACL.
27 28 29 |
# File 'lib/aws/ec2/network_acl.rb', line 27 def default @default end |
#network_acl_id ⇒ String (readonly) Also known as: id
37 38 39 |
# File 'lib/aws/ec2/network_acl.rb', line 37 def network_acl_id @network_acl_id end |
#vpc_id ⇒ String (readonly)
Returns the current value of vpc_id.
27 28 29 |
# File 'lib/aws/ec2/network_acl.rb', line 27 def vpc_id @vpc_id end |
Instance Method Details
#associations ⇒ Array<NetworkACL::Association>
Returns an array of Association objects (association to subnets).
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/aws/ec2/network_acl.rb', line 76 def associations association_set.map do |assoc| subnet = Subnet.new(assoc.subnet_id, :vpc_id => vpc_id, :config => config) Association.new(assoc.network_acl_association_id, self, subnet) end end |
#create_entry(options = {}) ⇒ nil
Adds an entry to this network ACL.
132 133 134 135 |
# File 'lib/aws/ec2/network_acl.rb', line 132 def create_entry = {} client.create_network_acl_entry(()) nil end |
#delete ⇒ nil
Deletes the current network ACL. You can not delete the default network ACL.
216 217 218 219 |
# File 'lib/aws/ec2/network_acl.rb', line 216 def delete client.delete_network_acl(:network_acl_id => network_acl_id) nil end |
#delete_entry(egress_or_ingress, rule_number) ⇒ nil
Deletes an entry from this network ACL. To delete an entry you need to know its rule number and if it is an egress or ingress rule.
# delete ingress rule 10
network_acl.delete_entry :egress, 10
# delete egress rules 5
network_acl.delete_entry :ingress, 5
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/aws/ec2/network_acl.rb', line 195 def delete_entry egress_or_ingress, rule_number unless [:ingress, :egress].include?(egress_or_ingress) msg = "expected :ingress or :egress for egress_or_ingress param" raise ArgumentError, msg end client_opts = {} client_opts[:network_acl_id] = network_acl_id client_opts[:egress] = egress_or_ingress == :egress client_opts[:rule_number] = rule_number client.delete_network_acl_entry(client_opts) nil end |
#entries ⇒ Array<NetworkACL::Entry>
Returns an array of all entries for this network ACL.
90 91 92 93 94 |
# File 'lib/aws/ec2/network_acl.rb', line 90 def entries entry_set.map do |entry_details| Entry.new(self, entry_details) end end |
#replace_entry(options = {}) ⇒ nil
Replaces the network ACL entry with the given :rule_number.
173 174 175 176 |
# File 'lib/aws/ec2/network_acl.rb', line 173 def replace_entry = {} client.replace_network_acl_entry(()) nil end |