Class: CfFactory::CfRoute

Inherits:
Object
  • Object
show all
Includes:
CfBase
Defined in:
lib/cf_factory/vpc/cf_route.rb

Instance Method Summary collapse

Methods included from CfBase

#generate, #generate_ref, #get_deletion_policy, #get_name, #get_update_policy, #hash_to_string, #retrieve_attribute, #set_meta_data, #set_quotes, #set_tags

Constructor Details

#initialize(name, dest_cidr, gateway = nil, instance = nil, eni = nil) ⇒ CfRoute

Returns a new instance of CfRoute.



7
8
9
10
11
12
13
# File 'lib/cf_factory/vpc/cf_route.rb', line 7

def initialize(name, dest_cidr, gateway = nil, instance = nil, eni = nil)
  @name = name
  @dest_cidr = dest_cidr  
  @gateway  = gateway
  @instance = instance
  @eni = eni
end

Instance Method Details

#add_associationObject



19
20
# File 'lib/cf_factory/vpc/cf_route.rb', line 19

def add_association()
end

#get_cf_attributesObject



26
27
28
# File 'lib/cf_factory/vpc/cf_route.rb', line 26

def get_cf_attributes
  {}
end

#get_cf_propertiesObject



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/cf_factory/vpc/cf_route.rb', line 30

def get_cf_properties
  options = {}
  unless @gateway.nil?
    options["GatewayId"] = @gateway.generate_ref
  end
  unless @instance.nil?
    options["InstanceId"] = @instance.generate_ref
  end
  unless @eni.nil?
    options["NetworkInterfaceId"] = @eni.generate_ref
  end
  {"RouteTableId" => @route_table.generate_ref, "DestinationCidrBlock" => @dest_cidr}.merge(options)
end

#get_cf_typeObject



22
23
24
# File 'lib/cf_factory/vpc/cf_route.rb', line 22

def get_cf_type
  "AWS::EC2::Route"
end

#set_route_table(route_table) ⇒ Object



15
16
17
# File 'lib/cf_factory/vpc/cf_route.rb', line 15

def set_route_table(route_table)
  @route_table = route_table
end