Class: Aws::EC2::Route
- Inherits:
-
Object
- Object
- Aws::EC2::Route
- Extended by:
- Deprecations
- Defined in:
- lib/aws-sdk-ec2/route.rb
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#carrier_gateway_id ⇒ String
The ID of the carrier gateway.
-
#core_network_arn ⇒ String
The Amazon Resource Name (ARN) of the core network.
- #destination_cidr_block ⇒ String
-
#destination_ipv_6_cidr_block ⇒ String
The IPv6 CIDR block used for the destination match.
-
#destination_prefix_list_id ⇒ String
The prefix of the Amazon Web Services service.
-
#egress_only_internet_gateway_id ⇒ String
The ID of the egress-only internet gateway.
-
#gateway_id ⇒ String
The ID of a gateway attached to your VPC.
-
#instance_id ⇒ String
The ID of a NAT instance in your VPC.
-
#instance_owner_id ⇒ String
The ID of Amazon Web Services account that owns the instance.
-
#local_gateway_id ⇒ String
The ID of the local gateway.
-
#nat_gateway_id ⇒ String
The ID of a NAT gateway.
-
#network_interface_id ⇒ String
The ID of the network interface.
-
#origin ⇒ String
Describes how the route was created.
- #route_table_id ⇒ String
-
#state ⇒ String
The state of the route.
-
#transit_gateway_id ⇒ String
The ID of a transit gateway.
-
#vpc_peering_connection_id ⇒ String
The ID of a VPC peering connection.
Actions collapse
Associations collapse
- #identifiers ⇒ Object deprecated private Deprecated.
- #route_table ⇒ RouteTable
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::Route
Returns the data for this Route.
-
#data_loaded? ⇒ Boolean
Returns ‘true` if this resource is loaded.
-
#initialize(*args) ⇒ Route
constructor
A new instance of Route.
- #load ⇒ Object (also: #reload) private
-
#wait_until(options = {}) {|resource| ... } ⇒ Resource
deprecated
Deprecated.
Use [Aws::EC2::Client] #wait_until instead
Constructor Details
#initialize(route_table_id, destination_cidr_block, options = {}) ⇒ Route #initialize(options = {}) ⇒ Route
Returns a new instance of Route.
24 25 26 27 28 29 30 31 |
# File 'lib/aws-sdk-ec2/route.rb', line 24 def initialize(*args) = Hash === args.last ? args.pop.dup : {} @route_table_id = extract_route_table_id(args, ) @destination_cidr_block = extract_destination_cidr_block(args, ) @data = .delete(:data) @client = .delete(:client) || Client.new() @waiter_block_warned = false end |
Instance Method Details
#carrier_gateway_id ⇒ String
The ID of the carrier gateway.
101 102 103 |
# File 'lib/aws-sdk-ec2/route.rb', line 101 def carrier_gateway_id data[:carrier_gateway_id] end |
#core_network_arn ⇒ String
The Amazon Resource Name (ARN) of the core network.
142 143 144 |
# File 'lib/aws-sdk-ec2/route.rb', line 142 def core_network_arn data[:core_network_arn] end |
#data ⇒ Types::Route
Returns the data for this Aws::EC2::Route.
164 165 166 167 |
# File 'lib/aws-sdk-ec2/route.rb', line 164 def data load unless @data @data end |
#data_loaded? ⇒ Boolean
172 173 174 |
# File 'lib/aws-sdk-ec2/route.rb', line 172 def data_loaded? !!@data end |
#delete(options = {}) ⇒ EmptyStructure
296 297 298 299 300 301 302 303 304 305 |
# File 'lib/aws-sdk-ec2/route.rb', line 296 def delete( = {}) = .merge( route_table_id: @route_table_id, destination_cidr_block: @destination_cidr_block ) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.delete_route() end resp.data end |
#destination_cidr_block ⇒ String
41 42 43 |
# File 'lib/aws-sdk-ec2/route.rb', line 41 def destination_cidr_block @destination_cidr_block end |
#destination_ipv_6_cidr_block ⇒ String
The IPv6 CIDR block used for the destination match.
47 48 49 |
# File 'lib/aws-sdk-ec2/route.rb', line 47 def destination_ipv_6_cidr_block data[:destination_ipv_6_cidr_block] end |
#destination_prefix_list_id ⇒ String
The prefix of the Amazon Web Services service.
53 54 55 |
# File 'lib/aws-sdk-ec2/route.rb', line 53 def destination_prefix_list_id data[:destination_prefix_list_id] end |
#egress_only_internet_gateway_id ⇒ String
The ID of the egress-only internet gateway.
59 60 61 |
# File 'lib/aws-sdk-ec2/route.rb', line 59 def egress_only_internet_gateway_id data[:egress_only_internet_gateway_id] end |
#gateway_id ⇒ String
The ID of a gateway attached to your VPC.
65 66 67 |
# File 'lib/aws-sdk-ec2/route.rb', line 65 def gateway_id data[:gateway_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.
388 389 390 391 392 393 |
# File 'lib/aws-sdk-ec2/route.rb', line 388 def identifiers { route_table_id: @route_table_id, destination_cidr_block: @destination_cidr_block } end |
#instance_id ⇒ String
The ID of a NAT instance in your VPC.
71 72 73 |
# File 'lib/aws-sdk-ec2/route.rb', line 71 def instance_id data[:instance_id] end |
#instance_owner_id ⇒ String
The ID of Amazon Web Services account that owns the instance.
77 78 79 |
# File 'lib/aws-sdk-ec2/route.rb', line 77 def instance_owner_id data[:instance_owner_id] end |
#load ⇒ Object Also known as: reload
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.
155 156 157 158 |
# File 'lib/aws-sdk-ec2/route.rb', line 155 def load msg = "#load is not implemented, data only available via enumeration" raise NotImplementedError, msg end |
#local_gateway_id ⇒ String
The ID of the local gateway.
95 96 97 |
# File 'lib/aws-sdk-ec2/route.rb', line 95 def local_gateway_id data[:local_gateway_id] end |
#nat_gateway_id ⇒ String
The ID of a NAT gateway.
83 84 85 |
# File 'lib/aws-sdk-ec2/route.rb', line 83 def nat_gateway_id data[:nat_gateway_id] end |
#network_interface_id ⇒ String
The ID of the network interface.
107 108 109 |
# File 'lib/aws-sdk-ec2/route.rb', line 107 def network_interface_id data[:network_interface_id] end |
#origin ⇒ String
Describes how the route was created.
-
‘CreateRouteTable` - The route was automatically created when the route table was created.
-
‘CreateRoute` - The route was manually added to the route table.
-
‘EnableVgwRoutePropagation` - The route was propagated by route propagation.
121 122 123 |
# File 'lib/aws-sdk-ec2/route.rb', line 121 def origin data[:origin] end |
#replace(options = {}) ⇒ EmptyStructure
365 366 367 368 369 370 371 372 373 374 |
# File 'lib/aws-sdk-ec2/route.rb', line 365 def replace( = {}) = .merge( route_table_id: @route_table_id, destination_cidr_block: @destination_cidr_block ) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.replace_route() end resp.data end |
#route_table ⇒ RouteTable
379 380 381 382 383 384 |
# File 'lib/aws-sdk-ec2/route.rb', line 379 def route_table RouteTable.new( id: @route_table_id, client: @client ) end |
#route_table_id ⇒ String
36 37 38 |
# File 'lib/aws-sdk-ec2/route.rb', line 36 def route_table_id @route_table_id end |
#state ⇒ String
The state of the route. The ‘blackhole` state indicates that the route’s target isn’t available (for example, the specified gateway isn’t attached to the VPC, or the specified NAT instance has been terminated).
130 131 132 |
# File 'lib/aws-sdk-ec2/route.rb', line 130 def state data[:state] end |
#transit_gateway_id ⇒ String
The ID of a transit gateway.
89 90 91 |
# File 'lib/aws-sdk-ec2/route.rb', line 89 def transit_gateway_id data[:transit_gateway_id] end |
#vpc_peering_connection_id ⇒ String
The ID of a VPC peering connection.
136 137 138 |
# File 'lib/aws-sdk-ec2/route.rb', line 136 def vpc_peering_connection_id data[:vpc_peering_connection_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
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/aws-sdk-ec2/route.rb', line 256 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.metric('RESOURCE_MODEL') do Aws::Waiters::Waiter.new().wait({}) end end |