Class: CfFactory::CfSubnet
- Inherits:
-
Object
- Object
- CfFactory::CfSubnet
show all
- Includes:
- CfBase
- Defined in:
- lib/cf_factory/vpc/cf_subnet.rb
Instance Method Summary
collapse
Methods included from CfBase
#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, cidr_block, availability_zone, route_table = nil, network_acl = nil) ⇒ CfSubnet
Returns a new instance of CfSubnet.
9
10
11
12
13
14
15
16
|
# File 'lib/cf_factory/vpc/cf_subnet.rb', line 9
def initialize(name, cidr_block, availability_zone, route_table = nil, network_acl = nil)
@name = name
@vpc = ":::::"
@cidr_block = cidr_block
@route_table = route_table
@network_acl = network_acl
@availability_zone = availability_zone
end
|
Instance Method Details
#generate ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/cf_factory/vpc/cf_subnet.rb', line 34
def generate
super
unless @route_table.nil?
name = "#{@name}RouteTableAssociation"
rta = CfRouteTableAssociation.new(name, self, @route_table)
@result += rta.generate
end
unless @network_acl.nil?
name = "#{@name}NetworkAclAssociation"
acl = CfNetworkAclAssociation.new(name, self, @network_acl)
@result += acl.generate
end
@result
end
|
#get_cf_attributes ⇒ Object
26
27
28
|
# File 'lib/cf_factory/vpc/cf_subnet.rb', line 26
def get_cf_attributes
{}
end
|
#get_cf_properties ⇒ Object
30
31
32
|
# File 'lib/cf_factory/vpc/cf_subnet.rb', line 30
def get_cf_properties
{"VpcId" => @vpc.generate_ref, "CidrBlock" => @cidr_block, "AvailabilityZone" => @availability_zone}
end
|
#get_cf_type ⇒ Object
22
23
24
|
# File 'lib/cf_factory/vpc/cf_subnet.rb', line 22
def get_cf_type
"AWS::EC2::Subnet"
end
|
#set_vpc(vpc) ⇒ Object
18
19
20
|
# File 'lib/cf_factory/vpc/cf_subnet.rb', line 18
def set_vpc(vpc)
@vpc = vpc
end
|