Class: Aws::EC2::Route

Inherits:
Object
  • Object
show all
Extended by:
Deprecations
Defined in:
sig/route.rbs,
lib/aws-sdk-ec2/route.rb

Overview

Defined Under Namespace

Classes: Collection

Read-Only Attributes collapse

Actions collapse

Associations collapse

Instance Method Summary collapse

Constructor Details

#initialize(route_table_id, destination_cidr_block, options = {}) ⇒ Route #initialize(options = {}) ⇒ Route

Returns a new instance of Route.

Overloads:

  • #initialize(route_table_id, destination_cidr_block, options = {}) ⇒ Route

    Parameters:

    • route_table_id (String)
    • destination_cidr_block (String)

    Options Hash (options):

  • #initialize(options = {}) ⇒ Route

    Options Hash (options):

    • :route_table_id (required, String)
    • :destination_cidr_block (required, String)
    • :client (Client)


13
14
15
# File 'sig/route.rbs', line 13

def initialize: (String route_table_id, String destination_cidr_block, Hash[Symbol, untyped] options) -> void
| (route_table_id: String, destination_cidr_block: String, ?client: Client) -> void
| (Hash[Symbol, untyped] args) -> void

Instance Method Details

#carrier_gateway_idString

The ID of the carrier gateway.

Returns:

  • (String)


51
# File 'sig/route.rbs', line 51

def carrier_gateway_id: () -> ::String

#clientClient

Returns:



165
# File 'lib/aws-sdk-ec2/route.rb', line 165

def client: () -> Client

#core_network_arnString

The Amazon Resource Name (ARN) of the core network.

Returns:

  • (String)


66
# File 'sig/route.rbs', line 66

def core_network_arn: () -> ::String

#dataTypes::Route

Returns the data for this Aws::EC2::Route.

Returns:

Raises:



78
# File 'sig/route.rbs', line 78

def data: () -> Types::Route

#data_loaded?Boolean

Returns true if this resource is loaded. Accessing attributes or #data on an unloaded resource will trigger a call to #load.

Returns:

  • (Boolean)

    Returns true if this resource is loaded. Accessing attributes or #data on an unloaded resource will trigger a call to #load.



81
# File 'sig/route.rbs', line 81

def data_loaded?: () -> bool

#delete(options = {}) ⇒ EmptyStructure

Examples:

Request syntax with placeholder values


route.delete({
  destination_prefix_list_id: "PrefixListResourceId",
  dry_run: false,
  destination_ipv_6_cidr_block: "String",
})

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Options Hash (options):

  • :destination_prefix_list_id (String)

    The ID of the prefix list for the route.

  • :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.

  • :destination_ipv_6_cidr_block (String)

    The IPv6 CIDR range for the route. The value you specify must match the CIDR for the route exactly.

Returns:

  • (EmptyStructure)


85
# File 'sig/route.rbs', line 85

def delete: (

#destination_cidr_blockString

Returns:

  • (String)


21
# File 'sig/route.rbs', line 21

def destination_cidr_block: () -> String

#destination_ipv_6_cidr_blockString

The IPv6 CIDR block used for the destination match.

Returns:

  • (String)


24
# File 'sig/route.rbs', line 24

def destination_ipv_6_cidr_block: () -> ::String

#destination_prefix_list_idString

The prefix of the Amazon Web Services service.

Returns:

  • (String)


27
# File 'sig/route.rbs', line 27

def destination_prefix_list_id: () -> ::String

#egress_only_internet_gateway_idString

The ID of the egress-only internet gateway.

Returns:

  • (String)


30
# File 'sig/route.rbs', line 30

def egress_only_internet_gateway_id: () -> ::String

#gateway_idString

The ID of a gateway attached to your VPC.

Returns:

  • (String)


33
# File 'sig/route.rbs', line 33

def gateway_id: () -> ::String

#identifiersObject

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.

Deprecated.


407
408
409
410
411
412
# File 'lib/aws-sdk-ec2/route.rb', line 407

def identifiers
  {
    route_table_id: @route_table_id,
    destination_cidr_block: @destination_cidr_block
  }
end

#instance_idString

The ID of a NAT instance in your VPC.

Returns:

  • (String)


36
# File 'sig/route.rbs', line 36

def instance_id: () -> ::String

#instance_owner_idString

The ID of Amazon Web Services account that owns the instance.

Returns:

  • (String)


39
# File 'sig/route.rbs', line 39

def instance_owner_id: () -> ::String

#ip_addressString

The next hop IP address for routes propagated by VPC Route Server into VPC route tables.

Returns:

  • (String)


72
# File 'sig/route.rbs', line 72

def ip_address: () -> ::String

#loadObject 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.

Raises:

  • (NotImplementedError)


171
172
173
174
# File 'lib/aws-sdk-ec2/route.rb', line 171

def load
  msg = "#load is not implemented, data only available via enumeration"
  raise NotImplementedError, msg
end

#local_gateway_idString

The ID of the local gateway.

Returns:

  • (String)


48
# File 'sig/route.rbs', line 48

def local_gateway_id: () -> ::String

#nat_gateway_idString

The ID of a NAT gateway.

Returns:

  • (String)


42
# File 'sig/route.rbs', line 42

def nat_gateway_id: () -> ::String

#network_interface_idString

The ID of the network interface.

Returns:

  • (String)


54
# File 'sig/route.rbs', line 54

def network_interface_id: () -> ::String

#odb_network_arnString

The Amazon Resource Name (ARN) of the ODB network.

Returns:

  • (String)


69
# File 'sig/route.rbs', line 69

def odb_network_arn: () -> ::String

#originString

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.

  • Advertisement - The route was created dynamically by Amazon VPC Route Server.

Returns:

  • (String)


57
# File 'sig/route.rbs', line 57

def origin: () -> ("CreateRouteTable" | "CreateRoute" | "EnableVgwRoutePropagation" | "Advertisement")

#replace(options = {}) ⇒ EmptyStructure

Examples:

Request syntax with placeholder values


route.replace({
  destination_prefix_list_id: "PrefixListResourceId",
  vpc_endpoint_id: "VpcEndpointId",
  local_target: false,
  transit_gateway_id: "TransitGatewayId",
  local_gateway_id: "LocalGatewayId",
  carrier_gateway_id: "CarrierGatewayId",
  core_network_arn: "CoreNetworkArn",
  odb_network_arn: "OdbNetworkArn",
  dry_run: false,
  gateway_id: "RouteGatewayId",
  destination_ipv_6_cidr_block: "String",
  egress_only_internet_gateway_id: "EgressOnlyInternetGatewayId",
  instance_id: "InstanceId",
  network_interface_id: "NetworkInterfaceId",
  vpc_peering_connection_id: "VpcPeeringConnectionId",
  nat_gateway_id: "NatGatewayId",
})

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Options Hash (options):

  • :destination_prefix_list_id (String)

    The ID of the prefix list for the route.

  • :vpc_endpoint_id (String)

    The ID of a VPC endpoint. Supported for Gateway Load Balancer endpoints only.

  • :local_target (Boolean)

    Specifies whether to reset the local route to its default target (local).

  • :transit_gateway_id (String)

    The ID of a transit gateway.

  • :local_gateway_id (String)

    The ID of the local gateway.

  • :carrier_gateway_id (String)

    [IPv4 traffic only] The ID of a carrier gateway.

  • :core_network_arn (String)

    The Amazon Resource Name (ARN) of the core network.

  • :odb_network_arn (String)

    The Amazon Resource Name (ARN) of the ODB network.

  • :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.

  • :gateway_id (String)

    The ID of an internet gateway or virtual private gateway.

  • :destination_ipv_6_cidr_block (String)

    The IPv6 CIDR address block used for the destination match. The value that you provide must match the CIDR of an existing route in the table.

  • :egress_only_internet_gateway_id (String)

    [IPv6 traffic only] The ID of an egress-only internet gateway.

  • :instance_id (String)

    The ID of a NAT instance in your VPC.

  • :network_interface_id (String)

    The ID of a network interface.

  • :vpc_peering_connection_id (String)

    The ID of a VPC peering connection.

  • :nat_gateway_id (String)

    [IPv4 traffic only] The ID of a NAT gateway.

Returns:

  • (EmptyStructure)


93
# File 'sig/route.rbs', line 93

def replace: (

#route_tableRouteTable

Returns:



114
# File 'sig/route.rbs', line 114

def route_table: () -> RouteTable

#route_table_idString

Returns:

  • (String)


18
# File 'sig/route.rbs', line 18

def route_table_id: () -> String

#stateString

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).

Returns:

  • (String)


60
# File 'sig/route.rbs', line 60

def state: () -> ("active" | "blackhole" | "filtered")

#transit_gateway_idString

The ID of a transit gateway.

Returns:

  • (String)


45
# File 'sig/route.rbs', line 45

def transit_gateway_id: () -> ::String

#vpc_peering_connection_idString

The ID of a VPC peering connection.

Returns:

  • (String)


63
# File 'sig/route.rbs', line 63

def vpc_peering_connection_id: () -> ::String

#wait_until(options = {}) {|resource| ... } ⇒ Resource

Deprecated.

Use [Aws::EC2::Client] #wait_until instead

Note:

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(options) {|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

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :max_attempts (Integer) — default: 10

    Maximum number of

  • :delay (Integer) — default: 10

    Delay between each

  • :before_attempt (Proc) — default: nil

    Callback

  • :before_wait (Proc) — default: nil

    Callback

Yield Parameters:

  • resource (Resource)

    to be used in the waiting condition.

Returns:

  • (Resource)

    if the waiter was successful

Raises:

  • (Aws::Waiters::Errors::FailureStateError)

    Raised when the waiter terminates because the waiter has entered a state that it will not transition out of, preventing success.

    yet successful.

  • (Aws::Waiters::Errors::UnexpectedError)

    Raised when an error is encountered while polling for a resource that is not expected.

  • (NotImplementedError)

    Raised when the resource does not



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/aws-sdk-ec2/route.rb', line 272

def wait_until(options = {}, &block)
  self_copy = self.dup
  attempts = 0
  options[:max_attempts] = 10 unless options.key?(:max_attempts)
  options[:delay] ||= 10
  options[:poller] = Proc.new do
    attempts += 1
    if block.call(self_copy)
      [:success, self_copy]
    else
      self_copy.reload unless attempts == options[:max_attempts]
      :retry
    end
  end
  Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
    Aws::Waiters::Waiter.new(options).wait({})
  end
end