cf_factory 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. data/bin/cf_factory +9 -0
  2. data/examples/base_vpc.rb +9 -9
  3. data/examples/cloudfront_private.rb +23 -0
  4. data/examples/cloudinit_script_for_one_instance.rb +25 -25
  5. data/examples/cloudinit_script_with_autoscaling.rb +31 -31
  6. data/examples/dynamodb_table.rb +24 -0
  7. data/examples/elastic_beanstalk_example.rb +23 -0
  8. data/examples/elb_with_cloudfront.rb +34 -35
  9. data/examples/instance_with_eip.rb +13 -11
  10. data/examples/instance_with_yum.rb +13 -11
  11. data/examples/just_an_instance.rb +8 -6
  12. data/examples/nat_mutual_monitoring.rb +69 -0
  13. data/examples/play_with_region_and_zones.rb +11 -9
  14. data/examples/ra_web_hosting.rb +46 -44
  15. data/examples/s3_with_cloudfront.rb +11 -12
  16. data/examples/test_vpc.rb +27 -19
  17. data/lib/cf_factory/as/cf_as_group.rb +2 -0
  18. data/lib/cf_factory/as/cf_as_launch_config.rb +2 -0
  19. data/lib/cf_factory/as/cf_as_scaling_policy.rb +2 -0
  20. data/lib/cf_factory/base/cf_base.rb +5 -0
  21. data/lib/cf_factory/base/cf_ec2_tag.rb +2 -0
  22. data/lib/cf_factory/base/cf_generator.rb +2 -0
  23. data/lib/cf_factory/base/cf_helper.rb +2 -0
  24. data/lib/cf_factory/base/cf_inner.rb +27 -8
  25. data/lib/cf_factory/base/cf_main.rb +3 -1
  26. data/lib/cf_factory/base/cf_mapping.rb +3 -1
  27. data/lib/cf_factory/base/cf_named_inner.rb +1 -0
  28. data/lib/cf_factory/base/cf_output.rb +2 -0
  29. data/lib/cf_factory/base/cf_parameter.rb +2 -0
  30. data/lib/cf_factory/base/cf_script_reader.rb +3 -1
  31. data/lib/cf_factory/cloudformation/cf_cloud_formation_init.rb +2 -0
  32. data/lib/cf_factory/cloudformation/cf_cloudformation_command.rb +2 -0
  33. data/lib/cf_factory/cloudformation/cf_cloudformation_commands.rb +2 -0
  34. data/lib/cf_factory/cloudformation/cf_cloudformation_config.rb +2 -0
  35. data/lib/cf_factory/cloudformation/cf_cloudformation_file.rb +2 -0
  36. data/lib/cf_factory/cloudformation/cf_cloudformation_files.rb +2 -0
  37. data/lib/cf_factory/cloudformation/cf_cloudformation_inner.rb +2 -0
  38. data/lib/cf_factory/cloudformation/cf_cloudformation_package.rb +2 -0
  39. data/lib/cf_factory/cloudformation/cf_cloudformation_packages.rb +2 -0
  40. data/lib/cf_factory/cloudformation/cf_cloudformation_sources.rb +2 -0
  41. data/lib/cf_factory/cloudformation/cf_init_script.rb +7 -0
  42. data/lib/cf_factory/cloudfront/cf_cache_behavior.rb +2 -0
  43. data/lib/cf_factory/cloudfront/cf_cache_behaviors.rb +3 -1
  44. data/lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb +2 -0
  45. data/lib/cf_factory/cloudfront/cf_custom_origin_config.rb +3 -1
  46. data/lib/cf_factory/cloudfront/cf_default_cache_behavior.rb +3 -1
  47. data/lib/cf_factory/cloudfront/cf_distribution_config.rb +4 -2
  48. data/lib/cf_factory/cloudfront/cf_forwarded_values.rb +3 -1
  49. data/lib/cf_factory/cloudfront/cf_logging.rb +3 -1
  50. data/lib/cf_factory/cloudfront/cf_origin.rb +3 -1
  51. data/lib/cf_factory/cloudfront/cf_s3_origin_config.rb +3 -1
  52. data/lib/cf_factory/cloudwatch/cf_cloud_watch_alarm.rb +2 -0
  53. data/lib/cf_factory/dynamo/cf_dynamo_table.rb +45 -0
  54. data/lib/cf_factory/eb/cd_eb_solution_stack.rb +28 -0
  55. data/lib/cf_factory/eb/cf_eb_application.rb +41 -0
  56. data/lib/cf_factory/eb/cf_eb_application_version.rb +24 -0
  57. data/lib/cf_factory/eb/cf_eb_configuration_template.rb +36 -0
  58. data/lib/cf_factory/eb/cf_eb_environment.rb +56 -0
  59. data/lib/cf_factory/eb/cf_eb_option_setting.rb +19 -0
  60. data/lib/cf_factory/ec2/cf_ebs_volume.rb +2 -0
  61. data/lib/cf_factory/ec2/cf_ec2_instance.rb +5 -1
  62. data/lib/cf_factory/ec2/cf_ec2_security_group.rb +2 -0
  63. data/lib/cf_factory/ec2/cf_ec2_security_group_egress.rb +3 -1
  64. data/lib/cf_factory/ec2/cf_ec2_security_group_ingress.rb +3 -1
  65. data/lib/cf_factory/ec2/cf_eip.rb +2 -0
  66. data/lib/cf_factory/ec2/cf_eip_association.rb +3 -1
  67. data/lib/cf_factory/elb/cf_app_cookie_stickiness_policy.rb +3 -1
  68. data/lib/cf_factory/elb/cf_elb.rb +3 -1
  69. data/lib/cf_factory/elb/cf_health_check.rb +3 -1
  70. data/lib/cf_factory/elb/cf_lb_cookie_stickiness_policy.rb +3 -1
  71. data/lib/cf_factory/elb/cf_listener.rb +3 -1
  72. data/lib/cf_factory/help/fixes.rb +1 -0
  73. data/lib/cf_factory/help/ip_mask.rb +2 -0
  74. data/lib/cf_factory/help/template_validation.rb +3 -1
  75. data/lib/cf_factory/iam/cf_iam_access_key.rb +3 -1
  76. data/lib/cf_factory/iam/cf_iam_group.rb +3 -1
  77. data/lib/cf_factory/iam/cf_iam_instance_profile.rb +3 -1
  78. data/lib/cf_factory/iam/cf_iam_policy.rb +2 -0
  79. data/lib/cf_factory/iam/cf_iam_role.rb +3 -1
  80. data/lib/cf_factory/iam/cf_iam_statement.rb +2 -0
  81. data/lib/cf_factory/iam/cf_iam_user.rb +3 -1
  82. data/lib/cf_factory/iam/cf_policy_document.rb +3 -1
  83. data/lib/cf_factory/modules/base_vpc.rb +2 -0
  84. data/lib/cf_factory/rds/cf_rds_instance.rb +3 -1
  85. data/lib/cf_factory/rds/cf_rds_security_group.rb +3 -1
  86. data/lib/cf_factory/rds/cf_rds_security_group_ingress.rb +3 -1
  87. data/lib/cf_factory/rds/cf_rds_subnet_group.rb +3 -1
  88. data/lib/cf_factory/route53/cf_elb_alias_target.rb +2 -0
  89. data/lib/cf_factory/route53/cf_record_set.rb +2 -0
  90. data/lib/cf_factory/route53/cf_route53_record_set.rb +2 -0
  91. data/lib/cf_factory/route53/cf_route53_record_set_group.rb +2 -0
  92. data/lib/cf_factory/s3/cf_s3_bucket.rb +2 -0
  93. data/lib/cf_factory/s3/cf_web_site_config.rb +3 -1
  94. data/lib/cf_factory/sqs/cf_sqs_queue.rb +3 -1
  95. data/lib/cf_factory/vpc/cf_attach_gateway.rb +3 -1
  96. data/lib/cf_factory/vpc/cf_internet_gateway.rb +2 -0
  97. data/lib/cf_factory/vpc/cf_network_acl.rb +3 -1
  98. data/lib/cf_factory/vpc/cf_network_acl_association.rb +3 -1
  99. data/lib/cf_factory/vpc/cf_network_acl_entry.rb +2 -0
  100. data/lib/cf_factory/vpc/cf_route.rb +3 -1
  101. data/lib/cf_factory/vpc/cf_route_table.rb +3 -1
  102. data/lib/cf_factory/vpc/cf_route_table_association.rb +3 -1
  103. data/lib/cf_factory/vpc/cf_subnet.rb +3 -1
  104. data/lib/cf_factory/vpc/cf_vpc.rb +3 -1
  105. data/lib/cf_factory.rb +2 -93
  106. metadata +39 -4
@@ -2,6 +2,7 @@ require 'cf_factory/base/cf_base'
2
2
  require 'cf_factory/base/cf_inner'
3
3
  require 'cf_factory/base/cf_helper'
4
4
 
5
+ module CfFactory
5
6
  class CfCloudFormationCommand
6
7
  include CfInner
7
8
 
@@ -35,3 +36,4 @@ class CfCloudFormationCommand
35
36
  end
36
37
 
37
38
  end
39
+ end
@@ -2,6 +2,7 @@ require 'cf_factory/base/cf_base'
2
2
  require 'cf_factory/base/cf_inner'
3
3
  require 'cf_factory/base/cf_helper'
4
4
 
5
+ module CfFactory
5
6
  class CfCloudFormationCommands
6
7
  include CfInner
7
8
 
@@ -23,3 +24,4 @@ class CfCloudFormationCommands
23
24
  end
24
25
 
25
26
  end
27
+ end
@@ -2,6 +2,7 @@ require 'cf_factory/base/cf_base'
2
2
  require 'cf_factory/base/cf_inner'
3
3
  require 'cf_factory/base/cf_helper'
4
4
 
5
+ module CfFactory
5
6
  class CfCloudFormationConfig
6
7
  include CfInner
7
8
 
@@ -31,3 +32,4 @@ class CfCloudFormationConfig
31
32
  end
32
33
 
33
34
  end
35
+ end
@@ -2,6 +2,7 @@ require 'cf_factory/base/cf_base'
2
2
  require 'cf_factory/base/cf_inner'
3
3
  require 'cf_factory/base/cf_helper'
4
4
 
5
+ module CfFactory
5
6
  class CfCloudFormationFile
6
7
  include CfInner
7
8
 
@@ -36,3 +37,4 @@ class CfCloudFormationFile
36
37
  end
37
38
 
38
39
  end
40
+ end
@@ -2,6 +2,7 @@ require 'cf_factory/base/cf_base'
2
2
  require 'cf_factory/base/cf_inner'
3
3
  require 'cf_factory/base/cf_helper'
4
4
 
5
+ module CfFactory
5
6
  class CfCloudFormationFiles
6
7
  include CfInner
7
8
 
@@ -23,3 +24,4 @@ class CfCloudFormationFiles
23
24
  end
24
25
 
25
26
  end
27
+ end
@@ -1,6 +1,7 @@
1
1
  require 'cf_factory/base/cf_base'
2
2
  require 'cf_factory/base/cf_inner'
3
3
 
4
+ module CfFactory
4
5
  class CfCloudFormationInner
5
6
  include CfInner
6
7
 
@@ -26,3 +27,4 @@ class CfCloudFormationInner
26
27
  end
27
28
 
28
29
  end
30
+ end
@@ -2,6 +2,7 @@ require 'cf_factory/base/cf_base'
2
2
  require 'cf_factory/base/cf_inner'
3
3
  require 'cf_factory/base/cf_helper'
4
4
 
5
+ module CfFactory
5
6
  class CfCloudFormationPackage
6
7
  include CfInner
7
8
 
@@ -32,3 +33,4 @@ class CfCloudFormationPackage
32
33
  CfGenerator.indent(self.additional_indent, "\"#{@package_name}\" : #{@versions.inspect}")
33
34
  end
34
35
  end
36
+ end
@@ -2,6 +2,7 @@ require 'cf_factory/base/cf_base'
2
2
  require 'cf_factory/base/cf_inner'
3
3
  require 'cf_factory/base/cf_helper'
4
4
 
5
+ module CfFactory
5
6
  class CfCloudFormationPackages
6
7
  include CfInner
7
8
 
@@ -40,3 +41,4 @@ class CfCloudFormationPackages
40
41
  end
41
42
 
42
43
  end
44
+ end
@@ -1,6 +1,7 @@
1
1
  require 'cf_factory/base/cf_base'
2
2
  require 'cf_factory/base/cf_inner'
3
3
 
4
+ module CfFactory
4
5
  class CfCloudFormationSources
5
6
  include CfInner
6
7
 
@@ -28,3 +29,4 @@ class CfCloudFormationSources
28
29
  end
29
30
 
30
31
  end
32
+ end
@@ -1,3 +1,4 @@
1
+ module CfFactory
1
2
  class CfInitScript
2
3
  # Every parameter-string will be transformed into something like { "Ref" : "<parameter>" }
3
4
  def initialize(script, parameter_array)
@@ -15,6 +16,11 @@ class CfInitScript
15
16
  CfInitScript.new(basic_script(), [stack, resource_id, access_key, secret_key])
16
17
  end
17
18
 
19
+ def self.create_from_text(file_path, params)
20
+ contents = File.open(file_path).read
21
+ CfInitScript.new(contents,params)
22
+ end
23
+
18
24
  private
19
25
 
20
26
  def validate
@@ -71,3 +77,4 @@ def self.basic_script_with_update
71
77
  end
72
78
 
73
79
  end
80
+ end
@@ -1,5 +1,6 @@
1
1
  require 'cf_factory/base/cf_inner'
2
2
 
3
+ module CfFactory
3
4
  class CfCacheBehavior
4
5
  include CfInner
5
6
 
@@ -35,3 +36,4 @@ class CfCacheBehavior
35
36
  end
36
37
 
37
38
  end
39
+ end
@@ -1,5 +1,6 @@
1
1
  require 'cf_factory/base/cf_inner'
2
2
 
3
+ module CfFactory
3
4
  class CfDefaultCacheBehaviors
4
5
  include CfInner
5
6
 
@@ -25,4 +26,5 @@ class CfDefaultCacheBehaviors
25
26
  result
26
27
  end
27
28
 
28
- end
29
+ end
30
+ end
@@ -1,5 +1,6 @@
1
1
  require 'cf_factory/base/cf_base'
2
2
 
3
+ module CfFactory
3
4
  class CfCloudfrontDistribution
4
5
  include CfBase
5
6
 
@@ -62,3 +63,4 @@ class CfCloudfrontDistribution
62
63
  end
63
64
 
64
65
  end
66
+ end
@@ -1,5 +1,6 @@
1
1
  require 'cf_factory/base/cf_inner'
2
2
 
3
+ module CfFactory
3
4
  class CfCustomOriginConfig
4
5
  PROTOCOL_VALUES = ["http-only","match-viewer"]
5
6
  include CfInner
@@ -34,4 +35,5 @@ class CfCustomOriginConfig
34
35
  raise Exception.new("protocol must be within #{PROTOCOL_VALUES}") unless PROTOCOL_VALUES.include?(@protocol)
35
36
  end
36
37
 
37
- end
38
+ end
39
+ end
@@ -1,5 +1,6 @@
1
1
  require 'cf_factory/base/cf_inner'
2
2
 
3
+ module CfFactory
3
4
  class CfDefaultCacheBehavior
4
5
  include CfInner
5
6
 
@@ -29,4 +30,5 @@ class CfDefaultCacheBehavior
29
30
  result
30
31
  end
31
32
 
32
- end
33
+ end
34
+ end
@@ -1,5 +1,6 @@
1
1
  require 'cf_factory/base/cf_inner'
2
2
 
3
+ module CfFactory
3
4
  class CfDistributionConfig
4
5
  include CfInner
5
6
 
@@ -20,12 +21,13 @@ class CfDistributionConfig
20
21
  def get_cf_attributes
21
22
  result = {}
22
23
  result["Origins"] = CfHelper.generate_inner_array(@origins)
23
- result["DefaultCacheBehavior"] = @default_cache_behaviour.generate
24
+ result["DefaultCacheBehavior"] = @default_cache_behaviour.generate unless @default_cache_behaviour.nil?
24
25
  result["Enabled"] = @enabled
25
26
  result["Logging"] = @logging.generate unless @logging.nil?
26
27
  result["Aliases"] = @aliases.inspect unless @aliases.nil?
27
- result["CacheBehaviors"] = CfHelper.generate_inner_array(@cache_behaviors)
28
+ result["CacheBehaviors"] = CfHelper.generate_inner_array(@cache_behaviors) unless @cache_bahaviors.nil?
28
29
  result
29
30
  end
30
31
 
31
32
  end
33
+ end
@@ -1,5 +1,6 @@
1
1
  require 'cf_factory/base/cf_inner'
2
2
 
3
+ module CfFactory
3
4
  class CfForwardedValues
4
5
  include CfInner
5
6
 
@@ -22,4 +23,5 @@ class CfForwardedValues
22
23
  result
23
24
  end
24
25
 
25
- end
26
+ end
27
+ end
@@ -1,5 +1,6 @@
1
1
  require 'cf_factory/base/cf_inner'
2
2
 
3
+ module CfFactory
3
4
  class CfLogging
4
5
  include CfInner
5
6
 
@@ -21,4 +22,5 @@ class CfLogging
21
22
  result
22
23
  end
23
24
 
24
- end
25
+ end
26
+ end
@@ -1,5 +1,6 @@
1
1
  require 'cf_factory/base/cf_inner'
2
2
 
3
+ module CfFactory
3
4
  class CfOrigin
4
5
  include CfInner
5
6
 
@@ -37,4 +38,5 @@ class CfOrigin
37
38
  result
38
39
  end
39
40
 
40
- end
41
+ end
42
+ end
@@ -1,5 +1,6 @@
1
1
  require 'cf_factory/base/cf_inner'
2
2
 
3
+ module CfFactory
3
4
  class CfS3OriginConfig
4
5
  include CfInner
5
6
 
@@ -22,4 +23,5 @@ class CfS3OriginConfig
22
23
  false
23
24
  end
24
25
 
25
- end
26
+ end
27
+ end
@@ -1,6 +1,7 @@
1
1
  require 'cf_factory/base/cf_base'
2
2
  require 'cf_factory/base/cf_helper'
3
3
 
4
+ module CfFactory
4
5
  class CfCloudWatchAlarm
5
6
  include CfBase
6
7
 
@@ -56,3 +57,4 @@ class CfCloudWatchAlarm
56
57
  end
57
58
 
58
59
  end
60
+ end
@@ -0,0 +1,45 @@
1
+ require 'cf_factory/base/cf_base'
2
+ module CfFactory
3
+ class CfDynamoTable
4
+ include CfBase
5
+
6
+ def initialize(name, read_capacity_units, write_capacity_units, hash_key_name, hash_key_type, range_key_name = nil, range_key_type = nil)
7
+ @name = name
8
+ @hash_key_name = hash_key_name
9
+ @hash_key_type = hash_key_type
10
+ @range_key_name = range_key_name
11
+ @range_key_type = range_key_type
12
+ @read_capacity_units = read_capacity_units
13
+ @write_capacity_units = write_capacity_units
14
+ end
15
+
16
+ def set_deletion_policy(deletion_policy)
17
+ @deletion_policy = deletion_policy
18
+ end
19
+
20
+ def get_cf_type
21
+ "AWS::DynamoDB::Table"
22
+ end
23
+
24
+ def get_cf_attributes
25
+ result = super
26
+ end
27
+
28
+ def get_cf_properties
29
+ result = {}
30
+ if @range_key_name then
31
+ result["KeySchema"] = {
32
+ "HashKeyElement" => { "AttributeName" => @hash_key_name, "AttributeType" => @hash_key_type },
33
+ "RangeKeyElement" => { "AttributeName" => @range_key_name, "AttributeType" => @range_key_type}
34
+ }
35
+ else
36
+ result["KeySchema"] = {
37
+ "HashKeyElement" => { "AttributeName" => @hash_key_name, "AttributeType" => @hash_key_type }
38
+ }
39
+ end
40
+ result["ProvisionedThroughput"] = { "ReadCapacityUnits" => @read_capacity_units, "WriteCapacityUnits" => @write_capacity_units }
41
+ result
42
+ end
43
+
44
+ end
45
+ end
@@ -0,0 +1,28 @@
1
+ module CfEbSolutionStack
2
+
3
+ SUPPORTED_STACK_NAMES = {
4
+ s32php54: "32bit Amazon Linux running PHP 5.4",
5
+ s64php54: "64bit Amazon Linux running PHP 5.4",
6
+ s32php53: "32bit Amazon Linux running PHP 5.3",
7
+ s64php53: "64bit Amazon Linux running PHP 5.3",
8
+ s64iis75: "64bit Windows Server 2008 R2 running IIS 7.5",
9
+ s64iis80: "64bit Windows Server 2012 running IIS 8",
10
+ s32tomcat7: "32bit Amazon Linux running Tomcat 7",
11
+ s64tomcat7: "64bit Amazon Linux running Tomcat 7",
12
+ s32tomcat6: "32bit Amazon Linux running Tomcat 6",
13
+ s64tomcat6: "64bit Amazon Linux running Tomcat 6",
14
+ s32python: "32bit Amazon Linux running Python",
15
+ s64python: "64bit Amazon Linux running Python",
16
+ s32ruby187: "32bit Amazon Linux running Ruby 1.8.7",
17
+ s64ruby187: "64bit Amazon Linux running Ruby 1.8.7",
18
+ s32ruby193: "32bit Amazon Linux running Ruby 1.9.3",
19
+ s64ruby193: "64bit Amazon Linux running Ruby 1.9.3"
20
+ }
21
+
22
+
23
+ def is_valid_stack?(stack_id)
24
+ SUPPORTED_STACK_NAMES.has_key?(stack_id)
25
+ end
26
+
27
+ end
28
+
@@ -0,0 +1,41 @@
1
+ require 'cf_factory/base/cf_base'
2
+ require 'cf_factory/base/cf_helper'
3
+
4
+ module CfFactory
5
+ class CfEbApplication
6
+ include CfBase
7
+
8
+ def initialize(name, description, application_versions, configuration_templates)
9
+ @name = name
10
+ @description = description
11
+ @application_versions = application_versions
12
+ @configuration_templates = configuration_templates
13
+ end
14
+
15
+ def set_tags(tag_list)
16
+ @tag_list = tag_list
17
+ end
18
+
19
+ def set_deletion_policy(deletion_policy)
20
+ @deletion_policy = deletion_policy
21
+ end
22
+
23
+ def get_cf_type
24
+ "AWS::ElasticBeanstalk::Application"
25
+ end
26
+
27
+ def get_cf_attributes
28
+ super
29
+ end
30
+
31
+ def get_cf_properties
32
+ result = {}
33
+ result["ApplicationVersions"] = CfHelper.generate_inner_array(@application_versions)
34
+ result["ConfigurationTemplates"] = CfHelper.generate_inner_array(@configuration_templates)
35
+ result["Description"] = @description
36
+ result
37
+ end
38
+
39
+
40
+ end
41
+ end
@@ -0,0 +1,24 @@
1
+ require 'cf_factory/base/cf_inner'
2
+
3
+ module CfFactory
4
+ class CfEbApplicationVersion
5
+ include CfInner
6
+
7
+
8
+ def initialize(description, source_bundle_bucket, source_bundle_key, version_label)
9
+
10
+ @description = description
11
+ @source_bundle_bucket = source_bundle_bucket
12
+ @source_bundle_key = source_bundle_key
13
+ @version_label = version_label
14
+
15
+ end
16
+
17
+ def get_cf_attributes
18
+ { "Description" => @description,
19
+ "SourceBundle" => { "S3Bucket" => @source_bundle_bucket, "S3Key" => @source_bundle_key },
20
+ "VersionLabel" => @version_label }
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,36 @@
1
+ require 'cf_factory/base/cf_inner'
2
+
3
+ module CfFactory
4
+ class CfEbConfigurationTemplate
5
+ include CfInner
6
+ include CfEbSolutionStack
7
+ def initialize(template_name, description, option_settings, solution_stack_name)
8
+ @template_name = template_name
9
+ @description = description
10
+ @option_settings = option_settings
11
+ @solution_stack_name = solution_stack_name
12
+ validate
13
+ end
14
+
15
+ def get_cf_attributes
16
+ { "TemplateName" => @template_name,
17
+ "Description" => @description,
18
+ "OptionSettings" => "[" + (@option_settings.map {|opt| opt.generate}).join(',') + "]",
19
+ "SolutionStackName" => SUPPORTED_STACK_NAMES[@solution_stack_name]
20
+ }
21
+ end
22
+
23
+ def generate_ref
24
+ "{ \"Ref\" : \"#{@template_name}\" }"
25
+ end
26
+
27
+ def get_template_name
28
+ @template_name
29
+ end
30
+
31
+ def validate
32
+ raise Exception.new("stack name not supported: #{@solution_stack_name}") unless is_valid_stack?(@solution_stack_name)
33
+ end
34
+
35
+ end
36
+ end
@@ -0,0 +1,56 @@
1
+ require 'cf_factory/base/cf_base'
2
+
3
+
4
+
5
+ module CfFactory
6
+ class CfEbEnvironment
7
+ include CfBase
8
+ include CfEbSolutionStack
9
+
10
+ def initialize(name, application_name, cname_prefix, description, option_settings, options_to_remove,
11
+ solution_stack_name, template_name, version_label)
12
+ @name = name
13
+ @application_name = application_name
14
+ @cname_prefix = cname_prefix
15
+ @description = description
16
+ @option_settings = option_settings
17
+ @options_to_remove = options_to_remove
18
+ @solution_stack_name = solution_stack_name
19
+ @template_name = template_name
20
+ @version_label = version_label
21
+
22
+ validate
23
+
24
+ end
25
+
26
+ def get_cf_type
27
+ "AWS::ElasticBeanstalk::Environment"
28
+ end
29
+
30
+ def get_cf_attributes
31
+ super
32
+ end
33
+
34
+ def get_cf_properties
35
+ result = {}
36
+ result["ApplicationName"] = @application_name
37
+ result["Description"] = @description
38
+ result["TemplateName"] = @template_name
39
+ result["VersionLabel"] = @version_label
40
+ result["SolutionStackName"] = SUPPORTED_STACK_NAMES[@solution_stack_name] unless @solution_stack_name.nil?
41
+ result["CNAMEPrefix"] = @cname_prefix unless @cname_prefix.nil?
42
+ result["OptionSettings"] = @option_settings unless @option_settings.nil?
43
+ result["OptionsToRemove"] = @options_to_remove unless @options_to_remove.nil?
44
+ result
45
+ end
46
+
47
+ def validate
48
+ if not @solution_stack_name.nil?
49
+ raise Exception.new("stack name not supported: #{@solution_stack_name}") unless is_valid_stack?(@solution_stack_name)
50
+ end
51
+ end
52
+
53
+
54
+ end
55
+
56
+ end
@@ -0,0 +1,19 @@
1
+ require 'cf_factory/base/cf_inner'
2
+
3
+ module CfFactory
4
+ class CfEbOptionSetting
5
+ include CfInner
6
+ def initialize(namespace, option_name, value)
7
+ @namespace=namespace
8
+ @option_name = option_name
9
+ @value = value
10
+ end
11
+
12
+ def get_cf_attributes
13
+ { "Namespace" => @namespace,
14
+ "OptionName" => @option_name,
15
+ "Value" => @value
16
+ }
17
+ end
18
+ end
19
+ end
@@ -1,4 +1,5 @@
1
1
  require 'cf_factory/base/cf_base'
2
+ module CfFactory
2
3
  class CfEbsVolume
3
4
  include CfBase
4
5
 
@@ -52,3 +53,4 @@ class CfEbsVolume
52
53
  end
53
54
 
54
55
  end
56
+ end
@@ -1,4 +1,5 @@
1
1
  require 'cf_factory/base/cf_base'
2
+ module CfFactory
2
3
  class CfEc2Instance
3
4
  SUPPORTED_TYPES = ["t1.micro","m1.small","m1.medium","m1.large","m1.xlarge",
4
5
  "m2.xlarge","m2.2xlarge","m2.4xlarge","m3.xlarge","m3.2xlarge","c1.medium", "c1.xlarge",
@@ -56,7 +57,10 @@ class CfEc2Instance
56
57
  private
57
58
 
58
59
  def validate
59
- raise Exception.new("instance type not supported #{@instance_type}") unless SUPPORTED_TYPES.include?(@instance_type)
60
+ unless @instance_type.include?("Ref")
61
+ raise Exception.new("instance type not supported #{@instance_type}") unless SUPPORTED_TYPES.include?(@instance_type)
62
+ end
60
63
  end
61
64
 
62
65
  end
66
+ end
@@ -1,4 +1,5 @@
1
1
  require 'cf_factory/base/cf_base'
2
+ module CfFactory
2
3
  class CfEc2SecurityGroup
3
4
  include CfBase
4
5
 
@@ -38,3 +39,4 @@ class CfEc2SecurityGroup
38
39
  end
39
40
 
40
41
  end
42
+ end
@@ -1,5 +1,6 @@
1
1
  require 'cf_factory/base/cf_inner'
2
2
 
3
+ module CfFactory
3
4
  class CfEc2SecurityGroupEgress
4
5
  include CfInner
5
6
 
@@ -25,4 +26,5 @@ class CfEc2SecurityGroupEgress
25
26
  result
26
27
  end
27
28
 
28
- end
29
+ end
30
+ end
@@ -1,5 +1,6 @@
1
1
  require 'cf_factory/base/cf_inner'
2
2
 
3
+ module CfFactory
3
4
  class CfEc2SecurityGroupIngress
4
5
  include CfInner
5
6
 
@@ -36,4 +37,5 @@ class CfEc2SecurityGroupIngress
36
37
  result
37
38
  end
38
39
 
39
- end
40
+ end
41
+ end
@@ -1,4 +1,5 @@
1
1
  require 'cf_factory/base/cf_base'
2
+ module CfFactory
2
3
  class CfEip
3
4
  include CfBase
4
5
 
@@ -24,3 +25,4 @@ class CfEip
24
25
  end
25
26
 
26
27
  end
28
+ end
@@ -1,5 +1,6 @@
1
1
  require 'cf_factory/base/cf_base'
2
2
 
3
+ module CfFactory
3
4
  class CfEipAssociation
4
5
  include CfBase
5
6
 
@@ -26,4 +27,5 @@ class CfEipAssociation
26
27
  result
27
28
  end
28
29
 
29
- end
30
+ end
31
+ end
@@ -1,5 +1,6 @@
1
1
  require 'cf_factory/base/cf_inner'
2
2
 
3
+ module CfFactory
3
4
  class CfAppCookieStickinessPolicy
4
5
  include CfInner
5
6
 
@@ -12,4 +13,5 @@ class CfAppCookieStickinessPolicy
12
13
  {"CookieName" => @cookie_name, "PolicyName" => @policy_name}
13
14
  end
14
15
 
15
- end
16
+ end
17
+ end