Sha256: 4d3d99d56d19e80b8f365b5a026020ae9c44eef61f30267c4baae3418a826145

Contents?: true

Size: 798 Bytes

Versions: 10

Compression:

Stored size: 798 Bytes

Contents

module Awspec::Type
  class RouteTable < Base
    attr_reader :route_table

    def initialize(id)
      super
      @route_table = find_route_table(id)
      @id = @route_table[:route_table_id] if @route_table
    end

    def has_route?(target, destination = nil)
      @route_table.routes.find do |route|
        if destination
          next false unless route.destination_cidr_block == destination
        end
        next true if route.gateway_id == target
        igw = find_internet_gateway(target)
        next true if igw.internet_gateway_id == target || igw.tag_name == target
      end
    end

    def method_missing(name)
      describe = name.to_sym
      if @route_table.members.include?(describe)
        @route_table[describe]
      else
        super
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
awspec-0.8.0 lib/awspec/type/route_table.rb
awspec-0.7.0 lib/awspec/type/route_table.rb
awspec-0.6.4 lib/awspec/type/route_table.rb
awspec-0.6.3 lib/awspec/type/route_table.rb
awspec-0.6.2 lib/awspec/type/route_table.rb
awspec-0.6.1 lib/awspec/type/route_table.rb
awspec-0.6.0 lib/awspec/type/route_table.rb
awspec-0.5.0 lib/awspec/type/route_table.rb
awspec-0.4.1 lib/awspec/type/route_table.rb
awspec-0.4.0 lib/awspec/type/route_table.rb