Class: Aws::EC2::NetworkAcl
- Inherits:
-
Object
- Object
- Aws::EC2::NetworkAcl
- Extended by:
- Deprecations
- Defined in:
- lib/aws-sdk-ec2/network_acl.rb
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#associations ⇒ Array<Types::NetworkAclAssociation>
Any associations between the network ACL and one or more subnets.
-
#entries ⇒ Array<Types::NetworkAclEntry>
The entries (rules) in the network ACL.
- #id ⇒ String (also: #network_acl_id)
-
#is_default ⇒ Boolean
Indicates whether this is the default network ACL for the VPC.
-
#owner_id ⇒ String
The ID of the Amazon Web Services account that owns the network ACL.
-
#tags ⇒ Array<Types::Tag>
Any tags assigned to the network ACL.
-
#vpc_id ⇒ String
The ID of the VPC for the network ACL.
Actions collapse
- #create_entry(options = {}) ⇒ EmptyStructure
- #create_tags(options = {}) ⇒ Tag::Collection
- #delete(options = {}) ⇒ EmptyStructure
- #delete_entry(options = {}) ⇒ EmptyStructure
- #delete_tags(options = {}) ⇒ Tag::Collection
- #replace_association(options = {}) ⇒ Types::ReplaceNetworkAclAssociationResult
- #replace_entry(options = {}) ⇒ EmptyStructure
Associations collapse
- #identifiers ⇒ Object deprecated private Deprecated.
- #vpc ⇒ Vpc?
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::NetworkAcl
Returns the data for this NetworkAcl.
-
#data_loaded? ⇒ Boolean
Returns ‘true` if this resource is loaded.
-
#initialize(*args) ⇒ NetworkAcl
constructor
A new instance of NetworkAcl.
-
#load ⇒ self
(also: #reload)
Loads, or reloads #data for the current NetworkAcl.
-
#wait_until(options = {}) {|resource| ... } ⇒ Resource
deprecated
Deprecated.
Use [Aws::EC2::Client] #wait_until instead
Constructor Details
#initialize(id, options = {}) ⇒ NetworkAcl #initialize(options = {}) ⇒ NetworkAcl
Returns a new instance of NetworkAcl.
22 23 24 25 26 27 28 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 22 def initialize(*args) = Hash === args.last ? args.pop.dup : {} @id = extract_id(args, ) @data = .delete(:data) @client = .delete(:client) || Client.new() @waiter_block_warned = false end |
Instance Method Details
#associations ⇒ Array<Types::NetworkAclAssociation>
Any associations between the network ACL and one or more subnets
40 41 42 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 40 def associations data[:associations] end |
#create_entry(options = {}) ⇒ EmptyStructure
273 274 275 276 277 278 279 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 273 def create_entry( = {}) = .merge(network_acl_id: @id) resp = Aws::Plugins::UserAgent.feature('resource') do @client.create_network_acl_entry() end resp.data end |
#create_tags(options = {}) ⇒ Tag::Collection
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 303 def ( = {}) batch = [] = Aws::Util.deep_merge(, resources: [@id]) resp = Aws::Plugins::UserAgent.feature('resource') do @client.() end [:tags].each do |t| batch << Tag.new( resource_id: @id, key: t[:key], value: t[:value], client: @client ) end Tag::Collection.new([batch], size: batch.size) end |
#data ⇒ Types::NetworkAcl
Returns the data for this Aws::EC2::NetworkAcl. Calls Client#describe_network_acls if #data_loaded? is ‘false`.
99 100 101 102 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 99 def data load unless @data @data end |
#data_loaded? ⇒ Boolean
107 108 109 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 107 def data_loaded? !!@data end |
#delete(options = {}) ⇒ EmptyStructure
379 380 381 382 383 384 385 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 379 def delete( = {}) = .merge(network_acl_id: @id) resp = Aws::Plugins::UserAgent.feature('resource') do @client.delete_network_acl() end resp.data end |
#delete_entry(options = {}) ⇒ EmptyStructure
405 406 407 408 409 410 411 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 405 def delete_entry( = {}) = .merge(network_acl_id: @id) resp = Aws::Plugins::UserAgent.feature('resource') do @client.delete_network_acl_entry() end resp.data end |
#delete_tags(options = {}) ⇒ Tag::Collection
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 350 def ( = {}) batch = [] = Aws::Util.deep_merge(, resources: [@id]) resp = Aws::Plugins::UserAgent.feature('resource') do @client.() end [:tags].each do |t| batch << Tag.new( resource_id: @id, key: t[:key], value: t[:value], client: @client ) end Tag::Collection.new([batch], size: batch.size) end |
#entries ⇒ Array<Types::NetworkAclEntry>
The entries (rules) in the network ACL.
46 47 48 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 46 def entries data[:entries] end |
#id ⇒ String Also known as: network_acl_id
33 34 35 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 33 def id @id end |
#identifiers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
517 518 519 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 517 def identifiers { id: @id } end |
#is_default ⇒ Boolean
Indicates whether this is the default network ACL for the VPC.
52 53 54 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 52 def is_default data[:is_default] end |
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::EC2::NetworkAcl. Returns ‘self` making it possible to chain methods.
network_acl.reload.data
87 88 89 90 91 92 93 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 87 def load resp = Aws::Plugins::UserAgent.feature('resource') do @client.describe_network_acls(network_acl_ids: [@id]) end @data = resp.network_acls[0] self end |
#owner_id ⇒ String
The ID of the Amazon Web Services account that owns the network ACL.
70 71 72 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 70 def owner_id data[:owner_id] end |
#replace_association(options = {}) ⇒ Types::ReplaceNetworkAclAssociationResult
429 430 431 432 433 434 435 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 429 def replace_association( = {}) = .merge(network_acl_id: @id) resp = Aws::Plugins::UserAgent.feature('resource') do @client.replace_network_acl_association() end resp.data end |
#replace_entry(options = {}) ⇒ EmptyStructure
493 494 495 496 497 498 499 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 493 def replace_entry( = {}) = .merge(network_acl_id: @id) resp = Aws::Plugins::UserAgent.feature('resource') do @client.replace_network_acl_entry() end resp.data end |
#tags ⇒ Array<Types::Tag>
Any tags assigned to the network ACL.
58 59 60 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 58 def data[:tags] end |
#vpc ⇒ Vpc?
504 505 506 507 508 509 510 511 512 513 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 504 def vpc if data[:vpc_id] Vpc.new( id: data[:vpc_id], client: @client ) else nil end end |
#vpc_id ⇒ String
The ID of the VPC for the network ACL.
64 65 66 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 64 def vpc_id data[:vpc_id] end |
#wait_until(options = {}) {|resource| ... } ⇒ Resource
Use [Aws::EC2::Client] #wait_until instead
The waiting operation is performed on a copy. The original resource remains unchanged.
Waiter polls an API operation until a resource enters a desired state.
## Basic Usage
Waiter will polls until it is successful, it fails by entering a terminal state, or until a maximum number of attempts are made.
# polls in a loop until condition is true
resource.wait_until() {|resource| condition}
## Example
instance.wait_until(max_attempts:10, delay:5) do |instance|
instance.state.name == 'running'
end
## Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. The waiting condition is set by passing a block to #wait_until:
# poll for ~25 seconds
resource.wait_until(max_attempts:5,delay:5) {|resource|...}
## Callbacks
You can be notified before each polling attempt and before each delay. If you throw ‘:success` or `:failure` from these callbacks, it will terminate the waiter.
started_at = Time.now
# poll for 1 hour, instead of a number of attempts
proc = Proc.new do |attempts, response|
throw :failure if Time.now - started_at > 3600
end
# disable max attempts
instance.wait_until(before_wait:proc, max_attempts:nil) {...}
## Handling Errors
When a waiter is successful, it returns the Resource. When a waiter fails, it raises an error.
begin
resource.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
attempts attempt in seconds invoked before each attempt invoked before each wait
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/aws-sdk-ec2/network_acl.rb', line 191 def wait_until( = {}, &block) self_copy = self.dup attempts = 0 [:max_attempts] = 10 unless .key?(:max_attempts) [:delay] ||= 10 [:poller] = Proc.new do attempts += 1 if block.call(self_copy) [:success, self_copy] else self_copy.reload unless attempts == [:max_attempts] :retry end end Aws::Plugins::UserAgent.feature('resource') do Aws::Waiters::Waiter.new().wait({}) end end |