Sha256: b07901489b3fb8f3164b3c05c603819821b35a94b04ff2f87b97fa16c2aa4425

Contents?: true

Size: 1.22 KB

Versions: 7

Compression:

Stored size: 1.22 KB

Contents

module VPC
  class RouteTable
    attr_reader :route_table_id,
                :associate_route_table_ids

    def initialize
      @associate_route_table_ids = []
    end

    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

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

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

    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

    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

    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

    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
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
etude_for_aws-0.7.10 lib/etude_for_aws/vpc/route_table.rb
etude_for_aws-0.7.9 lib/etude_for_aws/vpc/route_table.rb
etude_for_aws-0.7.8 lib/etude_for_aws/vpc/route_table.rb
etude_for_aws-0.7.7 lib/etude_for_aws/vpc/route_table.rb
etude_for_aws-0.7.6 lib/etude_for_aws/vpc/route_table.rb
etude_for_aws-0.7.5 lib/etude_for_aws/vpc/route_table.rb
etude_for_aws-0.7.4 lib/etude_for_aws/vpc/route_table.rb