Method: AWS::EC2::Subnet#set_route_table
- Defined in:
- lib/aws/ec2/subnet.rb
#set_route_table(route_table) ⇒ RouteTable::Association Also known as: route_table=
Sets the route table for this subnet. If there is already a route table associated with this subnet, that association is replaced.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/aws/ec2/subnet.rb', line 100 def set_route_table route_table unless route_table.is_a?(RouteTable) route_table = RouteTable.new(route_table, :config => config) end client_opts = {} client_opts[:route_table_id] = route_table.id assoc = route_table_association if assoc.main? client_opts[:subnet_id] = subnet_id response = client.associate_route_table(client_opts) association_id = response.association_id else client_opts[:association_id] = assoc.association_id resp = client.replace_route_table_association(client_opts) association_id = resp.new_association_id end RouteTable::Association.new(route_table, association_id, subnet_id) end |