cloud_former 0.1.10 → 0.2.0
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.
- checksums.yaml +4 -4
- data/lib/cloud_former/has_properties_and_attributes.rb +12 -0
- data/lib/cloud_former/makes_json.rb +10 -1
- data/lib/cloud_former/resource_properties/auto_scaling/update_policy.rb +12 -0
- data/lib/cloud_former/resources/auto_scaling/auto_scaling_group.rb +2 -0
- data/lib/cloud_former/version.rb +1 -1
- data/lib/cloud_former.rb +1 -0
- data/spec/resources/auto_scaling/auto_scaling_group_spec.rb +38 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5225f1b0df08b5385c209bc5032d76fc856df8b1
|
4
|
+
data.tar.gz: 95decca9be819bd3941c375ee9673a47a6a80158
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 056bfdf611c6475bd393088aebe3b53d2b13288e1d4e0f7720e5cee671f0847a23252afe410f8b4918b54c8086ea5278491408dc4762df9befbfde8152e74e02
|
7
|
+
data.tar.gz: 04a703ffe216488376bcd790aa57957fee35aa845bbc66fed415d66614d7978ee92e8c3c4b993fdd4edc89ec9e55ca88440aeec2fd62f59a773c6839ef18136c
|
@@ -19,6 +19,10 @@ module CloudFormer
|
|
19
19
|
make_aws_accessor(name, options)
|
20
20
|
end
|
21
21
|
|
22
|
+
def aws_attribute_wrapper(name)
|
23
|
+
@aws_attribute_wrapper = name
|
24
|
+
end
|
25
|
+
|
22
26
|
def check_type_of_aws_value(val, options)
|
23
27
|
if !val.is_a?(options[:type])
|
24
28
|
failed = true
|
@@ -99,6 +103,14 @@ module CloudFormer
|
|
99
103
|
end
|
100
104
|
answer
|
101
105
|
end
|
106
|
+
|
107
|
+
def get_aws_attribute_wrapper
|
108
|
+
if defined?(@aws_attribute_wrapper)
|
109
|
+
@aws_attribute_wrapper
|
110
|
+
else
|
111
|
+
nil
|
112
|
+
end
|
113
|
+
end
|
102
114
|
end
|
103
115
|
end
|
104
116
|
end
|
@@ -29,15 +29,24 @@ module CloudFormer
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
attribute_fill = res
|
33
|
+
if self.class.get_aws_attribute_wrapper
|
34
|
+
attribute_fill = {}
|
35
|
+
end
|
36
|
+
|
32
37
|
self.class.aws_attributes.try(:each) do |attribute|
|
33
38
|
val = attribute.as_json_for(self)
|
34
39
|
if val
|
35
40
|
use_name = attribute.options[:name]
|
36
41
|
use_name ||= ActiveSupport::Inflector.camelize(attribute.name)
|
37
|
-
|
42
|
+
attribute_fill[use_name] = val
|
38
43
|
end
|
39
44
|
end
|
40
45
|
|
46
|
+
if self.class.get_aws_attribute_wrapper
|
47
|
+
res[self.class.get_aws_attribute_wrapper] = attribute_fill
|
48
|
+
end
|
49
|
+
|
41
50
|
if properties.any?
|
42
51
|
res['Properties'] = properties
|
43
52
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html
|
2
|
+
module CloudFormer
|
3
|
+
module AutoScaling
|
4
|
+
class UpdatePolicy < ResourceProperty
|
5
|
+
aws_attribute_wrapper 'AutoScalingRollingUpdate'
|
6
|
+
|
7
|
+
aws_attribute :max_batch_size, type: String
|
8
|
+
aws_attribute :min_instances_in_service, type: String
|
9
|
+
aws_attribute :pause_time, type: String
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/cloud_former/version.rb
CHANGED
data/lib/cloud_former.rb
CHANGED
@@ -33,6 +33,7 @@ module CloudFormer
|
|
33
33
|
autoload :ScalingPolicy, 'cloud_former/resources/auto_scaling/scaling_policy'
|
34
34
|
autoload :ScheduledAction, 'cloud_former/resources/auto_scaling/scheduled_action'
|
35
35
|
autoload :Tag, 'cloud_former/resource_properties/auto_scaling/tag'
|
36
|
+
autoload :UpdatePolicy, 'cloud_former/resource_properties/auto_scaling/update_policy'
|
36
37
|
end
|
37
38
|
|
38
39
|
module CloudFormation
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe CloudFormer::AutoScaling::AutoScalingGroup do
|
4
4
|
|
5
|
-
let(:
|
5
|
+
let(:group) do
|
6
6
|
notification_config = CloudFormer::AutoScaling::NotificationConfiguration.new do
|
7
7
|
topic_arn 'abc'
|
8
8
|
notification_types [
|
@@ -18,7 +18,7 @@ describe CloudFormer::AutoScaling::AutoScalingGroup do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'should make some awesome json' do
|
21
|
-
expect(
|
21
|
+
expect(group.dump_json).to eq({
|
22
22
|
"Type" => "AWS::AutoScaling::AutoScalingGroup",
|
23
23
|
"Properties" => {
|
24
24
|
"NotificationConfiguration" => {
|
@@ -30,4 +30,40 @@ describe CloudFormer::AutoScaling::AutoScalingGroup do
|
|
30
30
|
}
|
31
31
|
})
|
32
32
|
end
|
33
|
+
|
34
|
+
describe 'with an update policy' do
|
35
|
+
|
36
|
+
let(:policy) do
|
37
|
+
CloudFormer::AutoScaling::UpdatePolicy.new do
|
38
|
+
max_batch_size 10
|
39
|
+
min_instances_in_service 1
|
40
|
+
pause_time 'PT12M5S'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
before do
|
45
|
+
group.update_policy(policy)
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should make awesome json' do
|
49
|
+
expect(group.dump_json).to eq({
|
50
|
+
"Type" => "AWS::AutoScaling::AutoScalingGroup",
|
51
|
+
"Properties" => {
|
52
|
+
"NotificationConfiguration" => {
|
53
|
+
"NotificationTypes" => ["autoscaling:EC2_INSTANCE_LAUNCH_ERROR"],
|
54
|
+
"TopicARN" => "abc",
|
55
|
+
},
|
56
|
+
"Cooldown" => 30,
|
57
|
+
"AvailabilityZones" => { "Fn::GetAZs" => "" }
|
58
|
+
},
|
59
|
+
"UpdatePolicy" => {
|
60
|
+
"AutoScalingRollingUpdate" => {
|
61
|
+
"MaxBatchSize"=>10,
|
62
|
+
"MinInstancesInService"=>1,
|
63
|
+
"PauseTime"=>"PT12M5S"
|
64
|
+
}
|
65
|
+
}
|
66
|
+
})
|
67
|
+
end
|
68
|
+
end
|
33
69
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloud_former
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aubrey Holland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- lib/cloud_former/resource_properties/auto_scaling/metrics_collection.rb
|
121
121
|
- lib/cloud_former/resource_properties/auto_scaling/notification_configuration.rb
|
122
122
|
- lib/cloud_former/resource_properties/auto_scaling/tag.rb
|
123
|
+
- lib/cloud_former/resource_properties/auto_scaling/update_policy.rb
|
123
124
|
- lib/cloud_former/resource_properties/cloud_formation/resource_tag.rb
|
124
125
|
- lib/cloud_former/resource_properties/cloud_front/cache_behavior.rb
|
125
126
|
- lib/cloud_former/resource_properties/cloud_front/custom_error_response.rb
|