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

Class: Aws::EC2::Route

Inherits:
Object
  • Object
show all
Defined in:
gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb

Defined Under Namespace

Classes: Collection

Actions collapse

Associations collapse

Read-Only Attributes 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)


21
22
23
24
25
26
27
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 21

def initialize(*args)
  options = Hash === args.last ? args.pop.dup : {}
  @route_table_id = extract_route_table_id(args, options)
  @destination_cidr_block = extract_destination_cidr_block(args, options)
  @data = options.delete(:data)
  @client = options.delete(:client) || Client.new(options)
end

Instance Method Details

#clientClient

Returns:



121
122
123
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 121

def client
  @client
end

#dataTypes::Route

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

Returns:

Raises:



136
137
138
139
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 136

def data
  load unless @data
  @data
end

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



144
145
146
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 144

def data_loaded?
  !!@data
end

#delete(options = {}) ⇒ EmptyStructure

Examples:

Request syntax with placeholder values


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

Parameters:

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

    ({})

Options Hash (options):

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

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

  • (EmptyStructure)


166
167
168
169
170
171
172
173
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 166

def delete(options = {})
  options = options.merge(
    route_table_id: @route_table_id,
    destination_cidr_block: @destination_cidr_block
  )
  resp = @client.delete_route(options)
  resp.data
end

#destination_cidr_blockString

Returns:

  • (String)


37
38
39
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 37

def destination_cidr_block
  @destination_cidr_block
end

#destination_ipv_6_cidr_blockString

The IPv6 CIDR block used for the destination match.

Returns:

  • (String)


43
44
45
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 43

def destination_ipv_6_cidr_block
  data.destination_ipv_6_cidr_block
end

#destination_prefix_list_idString

The prefix of the AWS service.

Returns:

  • (String)


49
50
51
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 49

def destination_prefix_list_id
  data.destination_prefix_list_id
end

#egress_only_internet_gateway_idString

The ID of the egress-only Internet gateway.

Returns:

  • (String)


55
56
57
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 55

def egress_only_internet_gateway_id
  data.egress_only_internet_gateway_id
end

#gateway_idString

The ID of a gateway attached to your VPC.

Returns:

  • (String)


61
62
63
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 61

def gateway_id
  data.gateway_id
end

#instance_idString

The ID of a NAT instance in your VPC.

Returns:

  • (String)


67
68
69
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 67

def instance_id
  data.instance_id
end

#instance_owner_idString

The AWS account ID of the owner of the instance.

Returns:

  • (String)


73
74
75
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 73

def instance_owner_id
  data.instance_owner_id
end

#nat_gateway_idString

The ID of a NAT gateway.

Returns:

  • (String)


79
80
81
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 79

def nat_gateway_id
  data.nat_gateway_id
end

#network_interface_idString

The ID of the network interface.

Returns:

  • (String)


85
86
87
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 85

def network_interface_id
  data.network_interface_id
end

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

Returns:

  • (String)


99
100
101
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 99

def origin
  data.origin
end

#replace(options = {}) ⇒ EmptyStructure

Examples:

Request syntax with placeholder values


route.replace({
  destination_ipv_6_cidr_block: "String",
  dry_run: false,
  egress_only_internet_gateway_id: "String",
  gateway_id: "String",
  instance_id: "String",
  nat_gateway_id: "String",
  network_interface_id: "String",
  vpc_peering_connection_id: "String",
})

Parameters:

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

    ({})

Options Hash (options):

  • :destination_ipv_6_cidr_block (String)

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

  • :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_only_internet_gateway_id (String)

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

  • :gateway_id (String)

    The ID of an Internet gateway or virtual private gateway.

  • :instance_id (String)

    The ID of a NAT instance in your VPC.

  • :nat_gateway_id (String)

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

  • :network_interface_id (String)

    The ID of a network interface.

  • :vpc_peering_connection_id (String)

    The ID of a VPC peering connection.

Returns:

  • (EmptyStructure)


209
210
211
212
213
214
215
216
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 209

def replace(options = {})
  options = options.merge(
    route_table_id: @route_table_id,
    destination_cidr_block: @destination_cidr_block
  )
  resp = @client.replace_route(options)
  resp.data
end

#route_tableRouteTable

Returns:



221
222
223
224
225
226
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 221

def route_table
  RouteTable.new(
    id: @route_table_id,
    client: @client
  )
end

#route_table_idString

Returns:

  • (String)


32
33
34
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 32

def route_table_id
  @route_table_id
end

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


108
109
110
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 108

def state
  data.state
end

#vpc_peering_connection_idString

The ID of the VPC peering connection.

Returns:

  • (String)


114
115
116
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb', line 114

def vpc_peering_connection_id
  data.vpc_peering_connection_id
end