cf_factory 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/bin/cf_factory +9 -9
  2. data/examples/base_vpc.rb +40 -40
  3. data/examples/cloudfront_private.rb +23 -23
  4. data/examples/cloudinit_script_for_one_instance.rb +77 -77
  5. data/examples/cloudinit_script_with_autoscaling.rb +85 -85
  6. data/examples/dynamodb_table.rb +24 -24
  7. data/examples/elastic_beanstalk_example.rb +23 -23
  8. data/examples/elb_with_cloudfront.rb +100 -100
  9. data/examples/instance_with_eip.rb +40 -40
  10. data/examples/instance_with_yum.rb +40 -40
  11. data/examples/just_an_instance.rb +31 -31
  12. data/examples/nat_mutual_monitoring.rb +69 -69
  13. data/examples/play_with_region_and_zones.rb +28 -28
  14. data/examples/ra_web_hosting.rb +148 -148
  15. data/examples/s3_with_cloudfront.rb +35 -35
  16. data/examples/test_vpc.rb +61 -61
  17. data/lib/cf_factory/as/cf_as_group.rb +80 -77
  18. data/lib/cf_factory/as/cf_as_launch_config.rb +55 -55
  19. data/lib/cf_factory/as/cf_as_scaling_policy.rb +35 -35
  20. data/lib/cf_factory/as/cf_as_update_policy.rb +23 -0
  21. data/lib/cf_factory/base/cf_base.rb +112 -102
  22. data/lib/cf_factory/base/cf_ec2_tag.rb +34 -34
  23. data/lib/cf_factory/base/cf_generator.rb +20 -20
  24. data/lib/cf_factory/base/cf_helper.rb +93 -93
  25. data/lib/cf_factory/base/cf_inner.rb +74 -74
  26. data/lib/cf_factory/base/cf_main.rb +103 -103
  27. data/lib/cf_factory/base/cf_mapping.rb +28 -28
  28. data/lib/cf_factory/base/cf_named_inner.rb +70 -1
  29. data/lib/cf_factory/base/cf_output.rb +26 -26
  30. data/lib/cf_factory/base/cf_parameter.rb +27 -27
  31. data/lib/cf_factory/base/cf_script_reader.rb +34 -34
  32. data/lib/cf_factory/cloudformation/cf_cloud_formation_init.rb +27 -27
  33. data/lib/cf_factory/cloudformation/cf_cloudformation_command.rb +39 -39
  34. data/lib/cf_factory/cloudformation/cf_cloudformation_commands.rb +27 -27
  35. data/lib/cf_factory/cloudformation/cf_cloudformation_config.rb +35 -35
  36. data/lib/cf_factory/cloudformation/cf_cloudformation_file.rb +40 -40
  37. data/lib/cf_factory/cloudformation/cf_cloudformation_files.rb +27 -27
  38. data/lib/cf_factory/cloudformation/cf_cloudformation_inner.rb +30 -30
  39. data/lib/cf_factory/cloudformation/cf_cloudformation_package.rb +36 -36
  40. data/lib/cf_factory/cloudformation/cf_cloudformation_packages.rb +44 -44
  41. data/lib/cf_factory/cloudformation/cf_cloudformation_sources.rb +32 -32
  42. data/lib/cf_factory/cloudformation/cf_init_script.rb +80 -80
  43. data/lib/cf_factory/cloudfront/cf_cache_behavior.rb +39 -39
  44. data/lib/cf_factory/cloudfront/cf_cache_behaviors.rb +30 -30
  45. data/lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb +66 -66
  46. data/lib/cf_factory/cloudfront/cf_custom_origin_config.rb +39 -39
  47. data/lib/cf_factory/cloudfront/cf_default_cache_behavior.rb +34 -34
  48. data/lib/cf_factory/cloudfront/cf_distribution_config.rb +33 -33
  49. data/lib/cf_factory/cloudfront/cf_forwarded_values.rb +27 -27
  50. data/lib/cf_factory/cloudfront/cf_logging.rb +26 -26
  51. data/lib/cf_factory/cloudfront/cf_origin.rb +42 -42
  52. data/lib/cf_factory/cloudfront/cf_s3_origin_config.rb +27 -27
  53. data/lib/cf_factory/cloudwatch/cf_cloud_watch_alarm.rb +60 -60
  54. data/lib/cf_factory/dynamo/cf_dynamo_table.rb +45 -45
  55. data/lib/cf_factory/eb/cd_eb_solution_stack.rb +27 -28
  56. data/lib/cf_factory/eb/cf_eb_application.rb +41 -41
  57. data/lib/cf_factory/eb/cf_eb_application_version.rb +24 -24
  58. data/lib/cf_factory/eb/cf_eb_configuration_template.rb +36 -36
  59. data/lib/cf_factory/eb/cf_eb_environment.rb +56 -56
  60. data/lib/cf_factory/eb/cf_eb_option_setting.rb +19 -19
  61. data/lib/cf_factory/ec2/cf_ebs_volume.rb +56 -56
  62. data/lib/cf_factory/ec2/cf_ec2_instance.rb +80 -66
  63. data/lib/cf_factory/ec2/cf_ec2_security_group.rb +42 -42
  64. data/lib/cf_factory/ec2/cf_ec2_security_group_egress.rb +30 -30
  65. data/lib/cf_factory/ec2/cf_ec2_security_group_ingress.rb +41 -41
  66. data/lib/cf_factory/ec2/cf_eip.rb +28 -28
  67. data/lib/cf_factory/ec2/cf_eip_association.rb +33 -31
  68. data/lib/cf_factory/ec2/cf_inner_network_interface.rb +26 -0
  69. data/lib/cf_factory/ec2/cf_network_interface.rb +40 -0
  70. data/lib/cf_factory/elb/cf_app_cookie_stickiness_policy.rb +17 -17
  71. data/lib/cf_factory/elb/cf_elb.rb +51 -51
  72. data/lib/cf_factory/elb/cf_health_check.rb +25 -25
  73. data/lib/cf_factory/elb/cf_lb_cookie_stickiness_policy.rb +17 -17
  74. data/lib/cf_factory/elb/cf_listener.rb +28 -28
  75. data/lib/cf_factory/help/fixes.rb +15 -15
  76. data/lib/cf_factory/help/ip_mask.rb +167 -167
  77. data/lib/cf_factory/help/template_validation.rb +30 -30
  78. data/lib/cf_factory/iam/cf_iam_access_key.rb +34 -34
  79. data/lib/cf_factory/iam/cf_iam_group.rb +32 -32
  80. data/lib/cf_factory/iam/cf_iam_instance_profile.rb +32 -32
  81. data/lib/cf_factory/iam/cf_iam_policy.rb +20 -20
  82. data/lib/cf_factory/iam/cf_iam_role.rb +58 -58
  83. data/lib/cf_factory/iam/cf_iam_statement.rb +25 -25
  84. data/lib/cf_factory/iam/cf_iam_user.rb +36 -36
  85. data/lib/cf_factory/iam/cf_policy_document.rb +21 -21
  86. data/lib/cf_factory/modules/base_vpc.rb +63 -63
  87. data/lib/cf_factory/rds/cf_rds_instance.rb +55 -55
  88. data/lib/cf_factory/rds/cf_rds_security_group.rb +35 -35
  89. data/lib/cf_factory/rds/cf_rds_security_group_ingress.rb +31 -31
  90. data/lib/cf_factory/rds/cf_rds_subnet_group.rb +31 -31
  91. data/lib/cf_factory/route53/cf_elb_alias_target.rb +23 -23
  92. data/lib/cf_factory/route53/cf_record_set.rb +63 -63
  93. data/lib/cf_factory/route53/cf_route53_record_set.rb +63 -63
  94. data/lib/cf_factory/route53/cf_route53_record_set_group.rb +44 -44
  95. data/lib/cf_factory/s3/cf_s3_bucket.rb +34 -34
  96. data/lib/cf_factory/s3/cf_web_site_config.rb +26 -26
  97. data/lib/cf_factory/sqs/cf_sqs_queue.rb +28 -28
  98. data/lib/cf_factory/vpc/cf_attach_gateway.rb +30 -30
  99. data/lib/cf_factory/vpc/cf_internet_gateway.rb +32 -32
  100. data/lib/cf_factory/vpc/cf_network_acl.rb +41 -41
  101. data/lib/cf_factory/vpc/cf_network_acl_association.rb +26 -26
  102. data/lib/cf_factory/vpc/cf_network_acl_entry.rb +39 -39
  103. data/lib/cf_factory/vpc/cf_route.rb +45 -45
  104. data/lib/cf_factory/vpc/cf_route_table.rb +43 -43
  105. data/lib/cf_factory/vpc/cf_route_table_association.rb +26 -26
  106. data/lib/cf_factory/vpc/cf_subnet.rb +50 -50
  107. data/lib/cf_factory/vpc/cf_vpc.rb +66 -66
  108. data/lib/cf_factory.rb +12 -12
  109. metadata +120 -91
@@ -1,30 +1,30 @@
1
- require 'cf_factory/base/cf_base'
2
- module CfFactory
3
- class CfAttachGateway
4
- include CfBase
5
-
6
- def initialize(name, vpc = nil, internet_gateway = nil, vpn_gateway = nil)
7
- @name = name
8
- @vpc = vpc
9
- @internet_gateway = internet_gateway
10
- @vpn_gateway = vpn_gateway
11
- end
12
-
13
- def get_cf_type
14
- "AWS::EC2::VPCGatewayAttachment"
15
- end
16
-
17
- def get_cf_attributes
18
- {}
19
- end
20
-
21
- def get_cf_properties
22
- result = {}
23
- result["VpcId"] = @vpc.generate_ref
24
- result["InternetGatewayId"] = @internet_gateway.generate_ref unless @internet_gateway.nil?
25
- result["VpnGatewayId"] = @vpn_gateway.generate_ref unless @vpn_gateway.nil?
26
- result
27
- end
28
-
29
- end
30
- end
1
+ require 'cf_factory/base/cf_base'
2
+ module CfFactory
3
+ class CfAttachGateway
4
+ include CfBase
5
+
6
+ def initialize(name, vpc = nil, internet_gateway = nil, vpn_gateway = nil)
7
+ @name = name
8
+ @vpc = vpc
9
+ @internet_gateway = internet_gateway
10
+ @vpn_gateway = vpn_gateway
11
+ end
12
+
13
+ def get_cf_type
14
+ "AWS::EC2::VPCGatewayAttachment"
15
+ end
16
+
17
+ def get_cf_attributes
18
+ {}
19
+ end
20
+
21
+ def get_cf_properties
22
+ result = {}
23
+ result["VpcId"] = @vpc.generate_ref
24
+ result["InternetGatewayId"] = @internet_gateway.generate_ref unless @internet_gateway.nil?
25
+ result["VpnGatewayId"] = @vpn_gateway.generate_ref unless @vpn_gateway.nil?
26
+ result
27
+ end
28
+
29
+ end
30
+ end
@@ -1,32 +1,32 @@
1
- require 'cf_factory/base/cf_base'
2
- require 'cf_factory/vpc/cf_attach_gateway'
3
-
4
- module CfFactory
5
- class CfInternetGateway
6
- include CfBase
7
-
8
- def initialize(name, vpn)
9
- @name = name
10
- @vpn = vpn
11
- end
12
-
13
- def get_cf_type
14
- "AWS::EC2::InternetGateway"
15
- end
16
-
17
- def get_cf_attributes
18
- {}
19
- end
20
-
21
- def get_cf_properties
22
- {}
23
- end
24
-
25
- def generate
26
- result = super
27
- result += CfAttachGateway.new("Attach#{@name}", @vpn, self).generate
28
- result
29
- end
30
-
31
- end
32
- end
1
+ require 'cf_factory/base/cf_base'
2
+ require 'cf_factory/vpc/cf_attach_gateway'
3
+
4
+ module CfFactory
5
+ class CfInternetGateway
6
+ include CfBase
7
+
8
+ def initialize(name, vpn)
9
+ @name = name
10
+ @vpn = vpn
11
+ end
12
+
13
+ def get_cf_type
14
+ "AWS::EC2::InternetGateway"
15
+ end
16
+
17
+ def get_cf_attributes
18
+ {}
19
+ end
20
+
21
+ def get_cf_properties
22
+ {}
23
+ end
24
+
25
+ def generate
26
+ result = super
27
+ result += CfAttachGateway.new("Attach#{@name}", @vpn, self).generate
28
+ result
29
+ end
30
+
31
+ end
32
+ end
@@ -1,41 +1,41 @@
1
- require 'cf_factory/base/cf_base'
2
- module CfFactory
3
- class CfNetworkAcl
4
- include CfBase
5
-
6
- def initialize(name)
7
- @name = name
8
- @entries = []
9
- end
10
-
11
- def add_network_acl_entry(network_acl_entry)
12
- network_acl_entry.set_network_acl(self)
13
- @entries << network_acl_entry
14
- end
15
-
16
- def set_vpc(vpc)
17
- @vpc = vpc
18
- end
19
-
20
- def get_cf_type
21
- "AWS::EC2::NetworkAcl"
22
- end
23
-
24
- def get_cf_attributes
25
- {}
26
- end
27
-
28
- def get_cf_properties
29
- {"VpcId" => @vpc.generate_ref}
30
- end
31
-
32
- def generate
33
- super
34
- @entries.each() {|entry|
35
- @result += entry.generate
36
- }
37
- @result
38
- end
39
-
40
- end
41
- end
1
+ require 'cf_factory/base/cf_base'
2
+ module CfFactory
3
+ class CfNetworkAcl
4
+ include CfBase
5
+
6
+ def initialize(name)
7
+ @name = name
8
+ @entries = []
9
+ end
10
+
11
+ def add_network_acl_entry(network_acl_entry)
12
+ network_acl_entry.set_network_acl(self)
13
+ @entries << network_acl_entry
14
+ end
15
+
16
+ def set_vpc(vpc)
17
+ @vpc = vpc
18
+ end
19
+
20
+ def get_cf_type
21
+ "AWS::EC2::NetworkAcl"
22
+ end
23
+
24
+ def get_cf_attributes
25
+ {}
26
+ end
27
+
28
+ def get_cf_properties
29
+ {"VpcId" => @vpc.generate_ref}
30
+ end
31
+
32
+ def generate
33
+ super
34
+ @entries.each() {|entry|
35
+ @result += entry.generate
36
+ }
37
+ @result
38
+ end
39
+
40
+ end
41
+ end
@@ -1,26 +1,26 @@
1
- require 'cf_factory/base/cf_base'
2
-
3
- module CfFactory
4
- class CfNetworkAclAssociation
5
- include CfBase
6
-
7
- def initialize(name, subnet, network_acl)
8
- @name = name
9
- @subnet = subnet
10
- @network_acl = network_acl
11
- end
12
-
13
- def get_cf_type
14
- "AWS::EC2::SubnetNetworkAclAssociation"
15
- end
16
-
17
- def get_cf_attributes
18
- {}
19
- end
20
-
21
- def get_cf_properties
22
- {"SubnetId" => @subnet.generate_ref, "NetworkAclId" => @network_acl.generate_ref}
23
- end
24
-
25
- end
26
- end
1
+ require 'cf_factory/base/cf_base'
2
+
3
+ module CfFactory
4
+ class CfNetworkAclAssociation
5
+ include CfBase
6
+
7
+ def initialize(name, subnet, network_acl)
8
+ @name = name
9
+ @subnet = subnet
10
+ @network_acl = network_acl
11
+ end
12
+
13
+ def get_cf_type
14
+ "AWS::EC2::SubnetNetworkAclAssociation"
15
+ end
16
+
17
+ def get_cf_attributes
18
+ {}
19
+ end
20
+
21
+ def get_cf_properties
22
+ {"SubnetId" => @subnet.generate_ref, "NetworkAclId" => @network_acl.generate_ref}
23
+ end
24
+
25
+ end
26
+ end
@@ -1,39 +1,39 @@
1
- require 'cf_factory/base/cf_base'
2
-
3
- module CfFactory
4
- class CfNetworkAclEntry
5
- include CfBase
6
-
7
- def initialize(name, rule_number, protocol, rule_action, egress, cidr_block, from_port, to_port)
8
- @name = name
9
- @rule_number = rule_number
10
- @protocol = protocol
11
- @rule_action = rule_action
12
- @egress = egress
13
- @cidr_block = cidr_block
14
- @from_port = from_port
15
- @to_port = to_port
16
- end
17
-
18
- def set_network_acl(network_acl)
19
- @network_acl = network_acl
20
- end
21
-
22
- def get_cf_type
23
- "AWS::EC2::NetworkAclEntry"
24
- end
25
-
26
- def get_cf_attributes
27
- {}
28
- end
29
-
30
- def get_cf_properties
31
- {"NetworkAclId" => @network_acl.generate_ref, "CidrBlock" => @cidr_block,
32
- "Protocol" => @protocol.to_i, "RuleNumber" => @rule_number.to_i, "RuleAction" => @rule_action, "Egress" => @egress,
33
- "PortRange" => {"From" => @from_port.to_i, "To" => @to_port.to_i }
34
- }
35
- end
36
-
37
-
38
- end
39
- end
1
+ require 'cf_factory/base/cf_base'
2
+
3
+ module CfFactory
4
+ class CfNetworkAclEntry
5
+ include CfBase
6
+
7
+ def initialize(name, rule_number, protocol, rule_action, egress, cidr_block, from_port, to_port)
8
+ @name = name
9
+ @rule_number = rule_number
10
+ @protocol = protocol
11
+ @rule_action = rule_action
12
+ @egress = egress
13
+ @cidr_block = cidr_block
14
+ @from_port = from_port
15
+ @to_port = to_port
16
+ end
17
+
18
+ def set_network_acl(network_acl)
19
+ @network_acl = network_acl
20
+ end
21
+
22
+ def get_cf_type
23
+ "AWS::EC2::NetworkAclEntry"
24
+ end
25
+
26
+ def get_cf_attributes
27
+ {}
28
+ end
29
+
30
+ def get_cf_properties
31
+ {"NetworkAclId" => @network_acl.generate_ref, "CidrBlock" => @cidr_block,
32
+ "Protocol" => @protocol.to_i, "RuleNumber" => @rule_number.to_i, "RuleAction" => @rule_action, "Egress" => @egress,
33
+ "PortRange" => {"From" => @from_port.to_i, "To" => @to_port.to_i }
34
+ }
35
+ end
36
+
37
+
38
+ end
39
+ end
@@ -1,45 +1,45 @@
1
- require 'cf_factory/base/cf_base'
2
-
3
- module CfFactory
4
- class CfRoute
5
- include CfBase
6
-
7
- def initialize(name, dest_cidr, gateway = nil, instance = nil, eni = nil)
8
- @name = name
9
- @dest_cidr = dest_cidr
10
- @gateway = gateway
11
- @instance = instance
12
- @eni = eni
13
- end
14
-
15
- def set_route_table(route_table)
16
- @route_table = route_table
17
- end
18
-
19
- def add_association()
20
- end
21
-
22
- def get_cf_type
23
- "AWS::EC2::Route"
24
- end
25
-
26
- def get_cf_attributes
27
- {}
28
- end
29
-
30
- def get_cf_properties
31
- options = {}
32
- unless @gateway.nil?
33
- options["GatewayId"] = @gateway.generate_ref
34
- end
35
- unless @instance.nil?
36
- options["InstanceId"] = @instance.generate_ref
37
- end
38
- unless @eni.nil?
39
- options["NetworkInterfaceId"] = @eni.generate_ref
40
- end
41
- {"RouteTableId" => @route_table.generate_ref, "DestinationCidrBlock" => @dest_cidr}.merge(options)
42
- end
43
-
44
- end
45
- end
1
+ require 'cf_factory/base/cf_base'
2
+
3
+ module CfFactory
4
+ class CfRoute
5
+ include CfBase
6
+
7
+ def initialize(name, dest_cidr, gateway = nil, instance = nil, eni = nil)
8
+ @name = name
9
+ @dest_cidr = dest_cidr
10
+ @gateway = gateway
11
+ @instance = instance
12
+ @eni = eni
13
+ end
14
+
15
+ def set_route_table(route_table)
16
+ @route_table = route_table
17
+ end
18
+
19
+ def add_association()
20
+ end
21
+
22
+ def get_cf_type
23
+ "AWS::EC2::Route"
24
+ end
25
+
26
+ def get_cf_attributes
27
+ {}
28
+ end
29
+
30
+ def get_cf_properties
31
+ options = {}
32
+ unless @gateway.nil?
33
+ options["GatewayId"] = @gateway.generate_ref
34
+ end
35
+ unless @instance.nil?
36
+ options["InstanceId"] = @instance.generate_ref
37
+ end
38
+ unless @eni.nil?
39
+ options["NetworkInterfaceId"] = @eni.generate_ref
40
+ end
41
+ {"RouteTableId" => @route_table.generate_ref, "DestinationCidrBlock" => @dest_cidr}.merge(options)
42
+ end
43
+
44
+ end
45
+ end
@@ -1,43 +1,43 @@
1
- require 'cf_factory/base/cf_base'
2
-
3
- module CfFactory
4
- class CfRouteTable
5
- include CfBase
6
-
7
- def initialize(name)
8
- @name = name
9
- @vpc = ":::::"
10
- @routes = []
11
- end
12
-
13
- def add_route(route)
14
- route.set_route_table(self)
15
- @routes << route
16
- end
17
-
18
- def set_vpc(vpc)
19
- @vpc = vpc
20
- end
21
-
22
- def get_cf_type
23
- "AWS::EC2::RouteTable"
24
- end
25
-
26
- def get_cf_attributes
27
- {}
28
- end
29
-
30
- def get_cf_properties
31
- {"VpcId" => @vpc.generate_ref}
32
- end
33
-
34
- def generate
35
- super
36
- @routes.each() {|route|
37
- @result += route.generate
38
- }
39
- @result
40
- end
41
-
42
- end
43
- end
1
+ require 'cf_factory/base/cf_base'
2
+
3
+ module CfFactory
4
+ class CfRouteTable
5
+ include CfBase
6
+
7
+ def initialize(name)
8
+ @name = name
9
+ @vpc = ":::::"
10
+ @routes = []
11
+ end
12
+
13
+ def add_route(route)
14
+ route.set_route_table(self)
15
+ @routes << route
16
+ end
17
+
18
+ def set_vpc(vpc)
19
+ @vpc = vpc
20
+ end
21
+
22
+ def get_cf_type
23
+ "AWS::EC2::RouteTable"
24
+ end
25
+
26
+ def get_cf_attributes
27
+ {}
28
+ end
29
+
30
+ def get_cf_properties
31
+ {"VpcId" => @vpc.generate_ref}
32
+ end
33
+
34
+ def generate
35
+ super
36
+ @routes.each() {|route|
37
+ @result += route.generate
38
+ }
39
+ @result
40
+ end
41
+
42
+ end
43
+ end
@@ -1,26 +1,26 @@
1
- require 'cf_factory/base/cf_base'
2
-
3
- module CfFactory
4
- class CfRouteTableAssociation
5
- include CfBase
6
-
7
- def initialize(name, subnet, route_table)
8
- @name = name
9
- @subnet = subnet
10
- @route_table = route_table
11
- end
12
-
13
- def get_cf_type
14
- "AWS::EC2::SubnetRouteTableAssociation"
15
- end
16
-
17
- def get_cf_attributes
18
- {}
19
- end
20
-
21
- def get_cf_properties
22
- {"SubnetId" => @subnet.generate_ref, "RouteTableId" => @route_table.generate_ref}
23
- end
24
-
25
- end
26
- end
1
+ require 'cf_factory/base/cf_base'
2
+
3
+ module CfFactory
4
+ class CfRouteTableAssociation
5
+ include CfBase
6
+
7
+ def initialize(name, subnet, route_table)
8
+ @name = name
9
+ @subnet = subnet
10
+ @route_table = route_table
11
+ end
12
+
13
+ def get_cf_type
14
+ "AWS::EC2::SubnetRouteTableAssociation"
15
+ end
16
+
17
+ def get_cf_attributes
18
+ {}
19
+ end
20
+
21
+ def get_cf_properties
22
+ {"SubnetId" => @subnet.generate_ref, "RouteTableId" => @route_table.generate_ref}
23
+ end
24
+
25
+ end
26
+ end
@@ -1,50 +1,50 @@
1
- require 'cf_factory/base/cf_base'
2
- require 'cf_factory/vpc/cf_route_table_association'
3
- require 'cf_factory/vpc/cf_network_acl_association'
4
-
5
- module CfFactory
6
- class CfSubnet
7
- include CfBase
8
-
9
- def initialize(name, cidr_block, availability_zone, route_table = nil, network_acl = nil)
10
- @name = name
11
- @vpc = ":::::"
12
- @cidr_block = cidr_block
13
- @route_table = route_table
14
- @network_acl = network_acl
15
- @availability_zone = availability_zone
16
- end
17
-
18
- def set_vpc(vpc)
19
- @vpc = vpc
20
- end
21
-
22
- def get_cf_type
23
- "AWS::EC2::Subnet"
24
- end
25
-
26
- def get_cf_attributes
27
- {}
28
- end
29
-
30
- def get_cf_properties
31
- {"VpcId" => @vpc.generate_ref, "CidrBlock" => @cidr_block, "AvailabilityZone" => @availability_zone}
32
- end
33
-
34
- def generate
35
- super
36
- unless @route_table.nil?
37
- name = "#{@name}RouteTableAssociation"
38
- rta = CfRouteTableAssociation.new(name, self, @route_table)
39
- @result += rta.generate
40
- end
41
- unless @network_acl.nil?
42
- name = "#{@name}NetworkAclAssociation"
43
- acl = CfNetworkAclAssociation.new(name, self, @network_acl)
44
- @result += acl.generate
45
- end
46
- @result
47
- end
48
-
49
- end
50
- end
1
+ require 'cf_factory/base/cf_base'
2
+ require 'cf_factory/vpc/cf_route_table_association'
3
+ require 'cf_factory/vpc/cf_network_acl_association'
4
+
5
+ module CfFactory
6
+ class CfSubnet
7
+ include CfBase
8
+
9
+ def initialize(name, cidr_block, availability_zone, route_table = nil, network_acl = nil)
10
+ @name = name
11
+ @vpc = ":::::"
12
+ @cidr_block = cidr_block
13
+ @route_table = route_table
14
+ @network_acl = network_acl
15
+ @availability_zone = availability_zone
16
+ end
17
+
18
+ def set_vpc(vpc)
19
+ @vpc = vpc
20
+ end
21
+
22
+ def get_cf_type
23
+ "AWS::EC2::Subnet"
24
+ end
25
+
26
+ def get_cf_attributes
27
+ {}
28
+ end
29
+
30
+ def get_cf_properties
31
+ {"VpcId" => @vpc.generate_ref, "CidrBlock" => @cidr_block, "AvailabilityZone" => @availability_zone}
32
+ end
33
+
34
+ def generate
35
+ super
36
+ unless @route_table.nil?
37
+ name = "#{@name}RouteTableAssociation"
38
+ rta = CfRouteTableAssociation.new(name, self, @route_table)
39
+ @result += rta.generate
40
+ end
41
+ unless @network_acl.nil?
42
+ name = "#{@name}NetworkAclAssociation"
43
+ acl = CfNetworkAclAssociation.new(name, self, @network_acl)
44
+ @result += acl.generate
45
+ end
46
+ @result
47
+ end
48
+
49
+ end
50
+ end