Class: VPC::RouteTable

Inherits:
Object
  • Object
show all
Defined in:
lib/etude_for_aws/vpc/route_table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRouteTable

Returns a new instance of RouteTable.



6
7
8
# File 'lib/etude_for_aws/vpc/route_table.rb', line 6

def initialize
  @associate_route_table_ids = []
end

Instance Attribute Details

#associate_route_table_idsObject (readonly)

Returns the value of attribute associate_route_table_ids.



3
4
5
# File 'lib/etude_for_aws/vpc/route_table.rb', line 3

def associate_route_table_ids
  @associate_route_table_ids
end

#route_table_idObject (readonly)

Returns the value of attribute route_table_id.



3
4
5
# File 'lib/etude_for_aws/vpc/route_table.rb', line 3

def route_table_id
  @route_table_id
end

Instance Method Details

#associate_route_table(vpc, route_table_id, subnet_id) ⇒ Object



31
32
33
# File 'lib/etude_for_aws/vpc/route_table.rb', line 31

def associate_route_table(vpc,route_table_id,subnet_id)
  @associate_route_table_ids << vpc.gateway.associate_route_table(route_table_id,subnet_id)
end

#create(vpc) ⇒ Object



15
16
17
# File 'lib/etude_for_aws/vpc/route_table.rb', line 15

def create(vpc)
  @route_table_id = vpc.gateway.create_route_table(vpc.vpc_id)
end

#create_private_route(vpc) ⇒ Object



19
20
21
# File 'lib/etude_for_aws/vpc/route_table.rb', line 19

def create_private_route(vpc)
  vpc.gateway.create_route_private(@route_table_id)
end

#create_public_route(vpc, destination_cidr_block, internet_gateway_id) ⇒ Object



23
24
25
# File 'lib/etude_for_aws/vpc/route_table.rb', line 23

def create_public_route(vpc,destination_cidr_block,internet_gateway_id)
  vpc.gateway.create_route_public(destination_cidr_block,internet_gateway_id,@route_table_id)
end

#create_vpn_route(vpc, destination_cidr_block, vpn_gateway_id) ⇒ Object



27
28
29
# File 'lib/etude_for_aws/vpc/route_table.rb', line 27

def create_vpn_route(vpc,destination_cidr_block,vpn_gateway_id)
  vpc.gateway.create_route_vpn(destination_cidr_block,vpn_gateway_id,@route_table_id)
end

#delete(vpc) ⇒ Object



35
36
37
38
39
40
# File 'lib/etude_for_aws/vpc/route_table.rb', line 35

def delete(vpc)
  @associate_route_table_ids.each do |id|
    vpc.gateway.disassociate_route_table(id)
  end
  vpc.gateway.delete_route_table(route_table_id)
end

#setup(id, vpc) ⇒ Object



10
11
12
13
# File 'lib/etude_for_aws/vpc/route_table.rb', line 10

def setup(id,vpc)
  @route_table_id = id
  @associate_route_table_ids = vpc.gateway.select_associate_route_table_ids_by_route_table_id(@route_table_id)
end