class Mappru::DSL::Context::VPC::RouteTable
Attributes
result[R]
Public Class Methods
new(context, vpc_id, name, &block)
click to toggle source
# File lib/mappru/dsl/context/vpc/route_table.rb, line 4 def initialize(context, vpc_id, name, &block) @vpc_id = vpc_id @name = name @context = context.merge(vpc_id: vpc_id, name: name) @result = {subnets: [], routes: []} instance_eval(&block) end
Private Instance Methods
route(attributes)
click to toggle source
# File lib/mappru/dsl/context/vpc/route_table.rb, line 24 def route(attributes) unless attributes.is_a?(Hash) raise "VPC `#{@vpc_id}` > Route Table `#{@name}`: Invalid route #{attributes.inspect}:#{attributes.class}" end @result[:routes] << attributes end
subnets(*subnet_ids)
click to toggle source
# File lib/mappru/dsl/context/vpc/route_table.rb, line 16 def subnets(*subnet_ids) if subnet_ids.empty? raise "VPC `#{@vpc_id}` > Route Table `#{@name}`: Subnet Id is empty" end @result[:subnets].concat(subnet_ids.map(&:to_s)) end