cloud_former 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +51 -0
  3. data/.rspec +3 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE +21 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +30 -0
  8. data/Rakefile +1 -0
  9. data/cloud_former.gemspec +26 -0
  10. data/lib/cloud_former/boolean.rb +5 -0
  11. data/lib/cloud_former/functions/base_64.rb +28 -0
  12. data/lib/cloud_former/functions/find_in_map.rb +36 -0
  13. data/lib/cloud_former/functions/function.rb +5 -0
  14. data/lib/cloud_former/functions/get_att.rb +19 -0
  15. data/lib/cloud_former/functions/get_azs.rb +14 -0
  16. data/lib/cloud_former/functions/join.rb +36 -0
  17. data/lib/cloud_former/has_properties_and_attributes.rb +104 -0
  18. data/lib/cloud_former/makes_json.rb +64 -0
  19. data/lib/cloud_former/metadata_resources/cloud_formation/authentication.rb +28 -0
  20. data/lib/cloud_former/metadata_resources/cloud_formation/authentication_item.rb +29 -0
  21. data/lib/cloud_former/metadata_resources/cloud_formation/config_set.rb +35 -0
  22. data/lib/cloud_former/metadata_resources/cloud_formation/config_set_command.rb +27 -0
  23. data/lib/cloud_former/metadata_resources/cloud_formation/config_set_file.rb +29 -0
  24. data/lib/cloud_former/metadata_resources/cloud_formation/config_set_group.rb +17 -0
  25. data/lib/cloud_former/metadata_resources/cloud_formation/config_set_item.rb +70 -0
  26. data/lib/cloud_former/metadata_resources/cloud_formation/config_set_service.rb +27 -0
  27. data/lib/cloud_former/metadata_resources/cloud_formation/config_set_user.rb +24 -0
  28. data/lib/cloud_former/metadata_resources/cloud_formation/init.rb +33 -0
  29. data/lib/cloud_former/metadata_resources/metadata_resource.rb +15 -0
  30. data/lib/cloud_former/parameters/commma_delimited_list_parameter.rb +9 -0
  31. data/lib/cloud_former/parameters/number_parameter.rb +9 -0
  32. data/lib/cloud_former/parameters/parameter.rb +30 -0
  33. data/lib/cloud_former/parameters/string_parameter.rb +9 -0
  34. data/lib/cloud_former/property_or_attribute.rb +49 -0
  35. data/lib/cloud_former/pseudo_parameters/account_id_parameter.rb +7 -0
  36. data/lib/cloud_former/pseudo_parameters/no_value_parameter.rb +7 -0
  37. data/lib/cloud_former/pseudo_parameters/notification_arns_parameter.rb +7 -0
  38. data/lib/cloud_former/pseudo_parameters/pseudo_parameter.rb +5 -0
  39. data/lib/cloud_former/pseudo_parameters/region_parameter.rb +7 -0
  40. data/lib/cloud_former/pseudo_parameters/stack_id_parameter.rb +7 -0
  41. data/lib/cloud_former/pseudo_parameters/stack_name_parameter.rb +7 -0
  42. data/lib/cloud_former/resource_properties/auto_scaling/block_device_mapping.rb +11 -0
  43. data/lib/cloud_former/resource_properties/auto_scaling/ebs_block_device.rb +12 -0
  44. data/lib/cloud_former/resource_properties/auto_scaling/metrics_collection.rb +9 -0
  45. data/lib/cloud_former/resource_properties/auto_scaling/notification_configuration.rb +16 -0
  46. data/lib/cloud_former/resource_properties/auto_scaling/tag.rb +10 -0
  47. data/lib/cloud_former/resource_properties/cloud_formation/resource_tag.rb +9 -0
  48. data/lib/cloud_former/resource_properties/cloud_front/cache_behavior.rb +15 -0
  49. data/lib/cloud_former/resource_properties/cloud_front/custom_error_response.rb +13 -0
  50. data/lib/cloud_former/resource_properties/cloud_front/custom_origin.rb +10 -0
  51. data/lib/cloud_former/resource_properties/cloud_front/default_cache_behavior.rb +14 -0
  52. data/lib/cloud_former/resource_properties/cloud_front/distribution_configuration.rb +27 -0
  53. data/lib/cloud_former/resource_properties/cloud_front/forwarded_values.rb +9 -0
  54. data/lib/cloud_former/resource_properties/cloud_front/forwarded_values_cookies.rb +9 -0
  55. data/lib/cloud_former/resource_properties/cloud_front/geo_restriction.rb +9 -0
  56. data/lib/cloud_former/resource_properties/cloud_front/logging.rb +10 -0
  57. data/lib/cloud_former/resource_properties/cloud_front/origin.rb +11 -0
  58. data/lib/cloud_former/resource_properties/cloud_front/restriction.rb +8 -0
  59. data/lib/cloud_former/resource_properties/cloud_front/s3_origin.rb +8 -0
  60. data/lib/cloud_former/resource_properties/cloud_front/viewer_certificate.rb +10 -0
  61. data/lib/cloud_former/resource_properties/cloud_watch/metric_dimension.rb +9 -0
  62. data/lib/cloud_former/resource_properties/ec2/security_group_rule.rb +15 -0
  63. data/lib/cloud_former/resource_properties/elastic_load_balancing/access_logging_policy.rb +11 -0
  64. data/lib/cloud_former/resource_properties/elastic_load_balancing/app_cookie_stickiness_policy.rb +9 -0
  65. data/lib/cloud_former/resource_properties/elastic_load_balancing/connection_draining_policy.rb +9 -0
  66. data/lib/cloud_former/resource_properties/elastic_load_balancing/health_check.rb +12 -0
  67. data/lib/cloud_former/resource_properties/elastic_load_balancing/lb_cookie_stickiness_policy.rb +9 -0
  68. data/lib/cloud_former/resource_properties/elastic_load_balancing/listener.rb +13 -0
  69. data/lib/cloud_former/resource_properties/elastic_load_balancing/policy.rb +12 -0
  70. data/lib/cloud_former/resource_properties/resource_property.rb +13 -0
  71. data/lib/cloud_former/resource_properties/s3/cors_configuration.rb +8 -0
  72. data/lib/cloud_former/resource_properties/s3/cors_rule.rb +13 -0
  73. data/lib/cloud_former/resource_properties/s3/lifecycle_configuration.rb +8 -0
  74. data/lib/cloud_former/resource_properties/s3/lifecycle_rule.rb +13 -0
  75. data/lib/cloud_former/resource_properties/s3/lifecycle_rule_transition.rb +10 -0
  76. data/lib/cloud_former/resource_properties/s3/logging_configuration.rb +9 -0
  77. data/lib/cloud_former/resource_properties/s3/notification_configuration.rb +11 -0
  78. data/lib/cloud_former/resource_properties/s3/notification_topic_configuration.rb +9 -0
  79. data/lib/cloud_former/resource_properties/s3/versioning_configuration.rb +8 -0
  80. data/lib/cloud_former/resource_properties/s3/website_configuration.rb +16 -0
  81. data/lib/cloud_former/resource_properties/s3/website_configuration_redirect_all_requests_to.rb +9 -0
  82. data/lib/cloud_former/resource_properties/s3/website_configuration_routing_rules.rb +13 -0
  83. data/lib/cloud_former/resource_properties/s3/website_configuration_routing_rules_redirect_rule.rb +12 -0
  84. data/lib/cloud_former/resource_properties/s3/website_configuration_routing_rules_routing_rule_condition.rb +9 -0
  85. data/lib/cloud_former/resource_properties/sns/subscription.rb +9 -0
  86. data/lib/cloud_former/resources/auto_scaling/auto_scaling_group.rb +31 -0
  87. data/lib/cloud_former/resources/auto_scaling/launch_configuration.rb +26 -0
  88. data/lib/cloud_former/resources/cloud_formation/wait_condition.rb +10 -0
  89. data/lib/cloud_former/resources/cloud_formation/wait_condition_handle.rb +7 -0
  90. data/lib/cloud_former/resources/cloud_front/distribution.rb +9 -0
  91. data/lib/cloud_former/resources/cloud_watch/alarm.rb +22 -0
  92. data/lib/cloud_former/resources/ec2/security_group.rb +21 -0
  93. data/lib/cloud_former/resources/elastic_load_balancing/load_balancer.rb +35 -0
  94. data/lib/cloud_former/resources/iam/access_key.rb +10 -0
  95. data/lib/cloud_former/resources/iam/group.rb +13 -0
  96. data/lib/cloud_former/resources/iam/policy.rb +12 -0
  97. data/lib/cloud_former/resources/iam/user.rb +15 -0
  98. data/lib/cloud_former/resources/resource.rb +31 -0
  99. data/lib/cloud_former/resources/s3/bucket.rb +29 -0
  100. data/lib/cloud_former/resources/sns/topic.rb +10 -0
  101. data/lib/cloud_former/template.rb +42 -0
  102. data/lib/cloud_former/version.rb +3 -0
  103. data/lib/cloud_former.rb +134 -0
  104. data/spec/metadata_spec.rb +152 -0
  105. data/spec/parameter_spec.rb +46 -0
  106. data/spec/resources/auto_scaling/auto_scaling_group_spec.rb +33 -0
  107. data/spec/resources/auto_scaling/launch_configuration_spec.rb +11 -0
  108. data/spec/resources/auto_scaling/notification_configuration_spec.rb +20 -0
  109. data/spec/resources/iam/access_key_spec.rb +43 -0
  110. data/spec/resources/iam/user_spec.rb +141 -0
  111. data/spec/spec_helper.rb +81 -0
  112. data/spec/template_spec.rb +53 -0
  113. data/spec/type_enforcement.rb +8 -0
  114. metadata +223 -0
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+
3
+ describe CloudFormer::Template do
4
+
5
+ let(:template) { CloudFormer::Template.new }
6
+ let(:parameter) { CloudFormer::StringParameter.new('sweet') }
7
+ let(:resource) do
8
+ CloudFormer::IAM::AccessKey.new('KEY') do
9
+ status 'Active'
10
+ user_name 'Aubrey'
11
+ end
12
+ end
13
+
14
+ it 'should produce JSON' do
15
+ expect(template.dump_json).to be_an_instance_of(Hash)
16
+ end
17
+
18
+ it 'should include the AWSTemplateFormatVersion by default' do
19
+ expect(template.dump_json).to eq({
20
+ 'AWSTemplateFormatVersion' => '2010-09-09'
21
+ })
22
+ end
23
+
24
+ it 'should include parameters' do
25
+ template.add_parameter(parameter)
26
+ expect(template.dump_json).to eq({
27
+ 'AWSTemplateFormatVersion' => '2010-09-09',
28
+ 'Parameters' => {
29
+ 'sweet' => {
30
+ 'Type' => 'String'
31
+ }
32
+ }
33
+ })
34
+ end
35
+
36
+ it 'should include resources' do
37
+ template.add_resource(resource)
38
+ expect(template.dump_json).to eq({
39
+ 'AWSTemplateFormatVersion' => '2010-09-09',
40
+ 'Resources' => {
41
+ resource.name => {
42
+ 'Type' => resource.aws_type,
43
+ 'Properties' => {
44
+ 'Status' => 'Active',
45
+ 'UserName' => 'Aubrey'
46
+ }
47
+ }
48
+ }
49
+ })
50
+ end
51
+
52
+
53
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'type enforcement' do
4
+
5
+ let(:resource) do
6
+ CloudFormer::AutoScaling::LaunchConfiguration.new('LaunchConfig')
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,223 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cloud_former
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Aubrey Holland
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: Write a longer description.
70
+ email:
71
+ - aubreyholland@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - Gemfile
79
+ - LICENSE
80
+ - LICENSE.txt
81
+ - README.md
82
+ - Rakefile
83
+ - cloud_former.gemspec
84
+ - lib/cloud_former.rb
85
+ - lib/cloud_former/boolean.rb
86
+ - lib/cloud_former/functions/base_64.rb
87
+ - lib/cloud_former/functions/find_in_map.rb
88
+ - lib/cloud_former/functions/function.rb
89
+ - lib/cloud_former/functions/get_att.rb
90
+ - lib/cloud_former/functions/get_azs.rb
91
+ - lib/cloud_former/functions/join.rb
92
+ - lib/cloud_former/has_properties_and_attributes.rb
93
+ - lib/cloud_former/makes_json.rb
94
+ - lib/cloud_former/metadata_resources/cloud_formation/authentication.rb
95
+ - lib/cloud_former/metadata_resources/cloud_formation/authentication_item.rb
96
+ - lib/cloud_former/metadata_resources/cloud_formation/config_set.rb
97
+ - lib/cloud_former/metadata_resources/cloud_formation/config_set_command.rb
98
+ - lib/cloud_former/metadata_resources/cloud_formation/config_set_file.rb
99
+ - lib/cloud_former/metadata_resources/cloud_formation/config_set_group.rb
100
+ - lib/cloud_former/metadata_resources/cloud_formation/config_set_item.rb
101
+ - lib/cloud_former/metadata_resources/cloud_formation/config_set_service.rb
102
+ - lib/cloud_former/metadata_resources/cloud_formation/config_set_user.rb
103
+ - lib/cloud_former/metadata_resources/cloud_formation/init.rb
104
+ - lib/cloud_former/metadata_resources/metadata_resource.rb
105
+ - lib/cloud_former/parameters/commma_delimited_list_parameter.rb
106
+ - lib/cloud_former/parameters/number_parameter.rb
107
+ - lib/cloud_former/parameters/parameter.rb
108
+ - lib/cloud_former/parameters/string_parameter.rb
109
+ - lib/cloud_former/property_or_attribute.rb
110
+ - lib/cloud_former/pseudo_parameters/account_id_parameter.rb
111
+ - lib/cloud_former/pseudo_parameters/no_value_parameter.rb
112
+ - lib/cloud_former/pseudo_parameters/notification_arns_parameter.rb
113
+ - lib/cloud_former/pseudo_parameters/pseudo_parameter.rb
114
+ - lib/cloud_former/pseudo_parameters/region_parameter.rb
115
+ - lib/cloud_former/pseudo_parameters/stack_id_parameter.rb
116
+ - lib/cloud_former/pseudo_parameters/stack_name_parameter.rb
117
+ - lib/cloud_former/resource_properties/auto_scaling/block_device_mapping.rb
118
+ - lib/cloud_former/resource_properties/auto_scaling/ebs_block_device.rb
119
+ - lib/cloud_former/resource_properties/auto_scaling/metrics_collection.rb
120
+ - lib/cloud_former/resource_properties/auto_scaling/notification_configuration.rb
121
+ - lib/cloud_former/resource_properties/auto_scaling/tag.rb
122
+ - lib/cloud_former/resource_properties/cloud_formation/resource_tag.rb
123
+ - lib/cloud_former/resource_properties/cloud_front/cache_behavior.rb
124
+ - lib/cloud_former/resource_properties/cloud_front/custom_error_response.rb
125
+ - lib/cloud_former/resource_properties/cloud_front/custom_origin.rb
126
+ - lib/cloud_former/resource_properties/cloud_front/default_cache_behavior.rb
127
+ - lib/cloud_former/resource_properties/cloud_front/distribution_configuration.rb
128
+ - lib/cloud_former/resource_properties/cloud_front/forwarded_values.rb
129
+ - lib/cloud_former/resource_properties/cloud_front/forwarded_values_cookies.rb
130
+ - lib/cloud_former/resource_properties/cloud_front/geo_restriction.rb
131
+ - lib/cloud_former/resource_properties/cloud_front/logging.rb
132
+ - lib/cloud_former/resource_properties/cloud_front/origin.rb
133
+ - lib/cloud_former/resource_properties/cloud_front/restriction.rb
134
+ - lib/cloud_former/resource_properties/cloud_front/s3_origin.rb
135
+ - lib/cloud_former/resource_properties/cloud_front/viewer_certificate.rb
136
+ - lib/cloud_former/resource_properties/cloud_watch/metric_dimension.rb
137
+ - lib/cloud_former/resource_properties/ec2/security_group_rule.rb
138
+ - lib/cloud_former/resource_properties/elastic_load_balancing/access_logging_policy.rb
139
+ - lib/cloud_former/resource_properties/elastic_load_balancing/app_cookie_stickiness_policy.rb
140
+ - lib/cloud_former/resource_properties/elastic_load_balancing/connection_draining_policy.rb
141
+ - lib/cloud_former/resource_properties/elastic_load_balancing/health_check.rb
142
+ - lib/cloud_former/resource_properties/elastic_load_balancing/lb_cookie_stickiness_policy.rb
143
+ - lib/cloud_former/resource_properties/elastic_load_balancing/listener.rb
144
+ - lib/cloud_former/resource_properties/elastic_load_balancing/policy.rb
145
+ - lib/cloud_former/resource_properties/resource_property.rb
146
+ - lib/cloud_former/resource_properties/s3/cors_configuration.rb
147
+ - lib/cloud_former/resource_properties/s3/cors_rule.rb
148
+ - lib/cloud_former/resource_properties/s3/lifecycle_configuration.rb
149
+ - lib/cloud_former/resource_properties/s3/lifecycle_rule.rb
150
+ - lib/cloud_former/resource_properties/s3/lifecycle_rule_transition.rb
151
+ - lib/cloud_former/resource_properties/s3/logging_configuration.rb
152
+ - lib/cloud_former/resource_properties/s3/notification_configuration.rb
153
+ - lib/cloud_former/resource_properties/s3/notification_topic_configuration.rb
154
+ - lib/cloud_former/resource_properties/s3/versioning_configuration.rb
155
+ - lib/cloud_former/resource_properties/s3/website_configuration.rb
156
+ - lib/cloud_former/resource_properties/s3/website_configuration_redirect_all_requests_to.rb
157
+ - lib/cloud_former/resource_properties/s3/website_configuration_routing_rules.rb
158
+ - lib/cloud_former/resource_properties/s3/website_configuration_routing_rules_redirect_rule.rb
159
+ - lib/cloud_former/resource_properties/s3/website_configuration_routing_rules_routing_rule_condition.rb
160
+ - lib/cloud_former/resource_properties/sns/subscription.rb
161
+ - lib/cloud_former/resources/auto_scaling/auto_scaling_group.rb
162
+ - lib/cloud_former/resources/auto_scaling/launch_configuration.rb
163
+ - lib/cloud_former/resources/cloud_formation/wait_condition.rb
164
+ - lib/cloud_former/resources/cloud_formation/wait_condition_handle.rb
165
+ - lib/cloud_former/resources/cloud_front/distribution.rb
166
+ - lib/cloud_former/resources/cloud_watch/alarm.rb
167
+ - lib/cloud_former/resources/ec2/security_group.rb
168
+ - lib/cloud_former/resources/elastic_load_balancing/load_balancer.rb
169
+ - lib/cloud_former/resources/iam/access_key.rb
170
+ - lib/cloud_former/resources/iam/group.rb
171
+ - lib/cloud_former/resources/iam/policy.rb
172
+ - lib/cloud_former/resources/iam/user.rb
173
+ - lib/cloud_former/resources/resource.rb
174
+ - lib/cloud_former/resources/s3/bucket.rb
175
+ - lib/cloud_former/resources/sns/topic.rb
176
+ - lib/cloud_former/template.rb
177
+ - lib/cloud_former/version.rb
178
+ - spec/metadata_spec.rb
179
+ - spec/parameter_spec.rb
180
+ - spec/resources/auto_scaling/auto_scaling_group_spec.rb
181
+ - spec/resources/auto_scaling/launch_configuration_spec.rb
182
+ - spec/resources/auto_scaling/notification_configuration_spec.rb
183
+ - spec/resources/iam/access_key_spec.rb
184
+ - spec/resources/iam/user_spec.rb
185
+ - spec/spec_helper.rb
186
+ - spec/template_spec.rb
187
+ - spec/type_enforcement.rb
188
+ homepage: http://github.com/custora/cloud_former
189
+ licenses:
190
+ - MIT
191
+ metadata: {}
192
+ post_install_message:
193
+ rdoc_options: []
194
+ require_paths:
195
+ - lib
196
+ required_ruby_version: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - ">="
199
+ - !ruby/object:Gem::Version
200
+ version: '0'
201
+ required_rubygems_version: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ requirements: []
207
+ rubyforge_project:
208
+ rubygems_version: 2.2.2
209
+ signing_key:
210
+ specification_version: 4
211
+ summary: A Ruby DSL for creating CloudFormation templates
212
+ test_files:
213
+ - spec/metadata_spec.rb
214
+ - spec/parameter_spec.rb
215
+ - spec/resources/auto_scaling/auto_scaling_group_spec.rb
216
+ - spec/resources/auto_scaling/launch_configuration_spec.rb
217
+ - spec/resources/auto_scaling/notification_configuration_spec.rb
218
+ - spec/resources/iam/access_key_spec.rb
219
+ - spec/resources/iam/user_spec.rb
220
+ - spec/spec_helper.rb
221
+ - spec/template_spec.rb
222
+ - spec/type_enforcement.rb
223
+ has_rdoc: