aws-cfn-resources 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws-cloudformation-stack.rb +61 -22
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05653f56afb0c8968dfe364b3a4651e2d1741494
|
4
|
+
data.tar.gz: c3884f0764220cbf61dce3678e798ef157804ae8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f71c0f4d40229defe90037a124dd39a58d10032b451bdd89a9fe64bf56c64d7ff5bb143acafe441689750a9b73312bdd1b525deb497e8172ce5ea3910ed9ee59
|
7
|
+
data.tar.gz: 7e5c0ce5b3ae1da284fc3597deadb3997f3b1a43dbb7d5e29332043863f64634023b71555f846e52416816098269570ef3dc1298603ed43256c112ef49a8416b
|
@@ -6,9 +6,24 @@ require 'aws-sdk-v1'
|
|
6
6
|
module AWS
|
7
7
|
class CloudFormation
|
8
8
|
class Stack
|
9
|
+
|
10
|
+
def initialize name, options = {}
|
11
|
+
@name = name
|
12
|
+
|
13
|
+
@as = AWS::AutoScaling.new
|
14
|
+
@cw = AWS::CloudWatch.new
|
15
|
+
@ec2 = AWS::EC2.new
|
16
|
+
@elb = AWS::ELB.new
|
17
|
+
@iam = AWS::IAM.new
|
18
|
+
@rds = AWS::RDS.new
|
19
|
+
@s3 = AWS::S3.new
|
20
|
+
|
21
|
+
super
|
22
|
+
end
|
9
23
|
|
10
24
|
def autoscaling_group(logical_id)
|
11
|
-
|
25
|
+
id = autoscaling_group_ids[logical_id.to_sym]
|
26
|
+
@as.groups[id] if id
|
12
27
|
end
|
13
28
|
|
14
29
|
def autoscaling_groups
|
@@ -20,7 +35,8 @@ module AWS
|
|
20
35
|
end
|
21
36
|
|
22
37
|
def bucket(logical_id)
|
23
|
-
|
38
|
+
id = bucket_ids[logical_id.to_sym]
|
39
|
+
@s3.buckets[id] if id
|
24
40
|
end
|
25
41
|
|
26
42
|
def buckets
|
@@ -32,7 +48,8 @@ module AWS
|
|
32
48
|
end
|
33
49
|
|
34
50
|
def cloudwatch_alarm(logical_id)
|
35
|
-
|
51
|
+
id = cloudwatch_alarm_ids[logical_id.to_sym]
|
52
|
+
@cw.alarms[id] if id
|
36
53
|
end
|
37
54
|
|
38
55
|
def cloudwatch_alarms
|
@@ -56,7 +73,8 @@ module AWS
|
|
56
73
|
end
|
57
74
|
|
58
75
|
def eip(logical_id)
|
59
|
-
|
76
|
+
id = eip_ids[logical_id.to_sym]
|
77
|
+
@ec2.elastic_ips[id] if id
|
60
78
|
end
|
61
79
|
|
62
80
|
alias_method :elastic_ip, :eip
|
@@ -72,7 +90,8 @@ module AWS
|
|
72
90
|
end
|
73
91
|
|
74
92
|
def elb(logical_id)
|
75
|
-
|
93
|
+
id = elb_ids[logical_id.to_sym]
|
94
|
+
@elb.load_balancers[id] if id
|
76
95
|
end
|
77
96
|
|
78
97
|
def elbs
|
@@ -84,7 +103,13 @@ module AWS
|
|
84
103
|
end
|
85
104
|
|
86
105
|
def iam_access_key(user_logical_id, key_logical_id)
|
87
|
-
|
106
|
+
id = iam_access_key_ids[key_logical_id.to_sym]
|
107
|
+
user = iam_user(user_logical_id)
|
108
|
+
if (id && user)
|
109
|
+
user.access_keys[id]
|
110
|
+
else
|
111
|
+
nil
|
112
|
+
end
|
88
113
|
end
|
89
114
|
|
90
115
|
def iam_access_key_ids
|
@@ -92,7 +117,8 @@ module AWS
|
|
92
117
|
end
|
93
118
|
|
94
119
|
def iam_group(logical_id)
|
95
|
-
|
120
|
+
id = iam_group_ids[logical_id.to_sym]
|
121
|
+
@iam.groups[id] if id
|
96
122
|
end
|
97
123
|
|
98
124
|
def iam_groups
|
@@ -114,7 +140,8 @@ module AWS
|
|
114
140
|
end
|
115
141
|
|
116
142
|
def iam_user(logical_id)
|
117
|
-
|
143
|
+
id = iam_user_ids[logical_id.to_sym]
|
144
|
+
@iam.users[id] if id
|
118
145
|
end
|
119
146
|
|
120
147
|
def iam_users
|
@@ -126,7 +153,8 @@ module AWS
|
|
126
153
|
end
|
127
154
|
|
128
155
|
def instance(logical_id)
|
129
|
-
|
156
|
+
id = instance_ids[logical_id.to_sym]
|
157
|
+
@ec2.instances[id] if id
|
130
158
|
end
|
131
159
|
|
132
160
|
def instances
|
@@ -138,7 +166,8 @@ module AWS
|
|
138
166
|
end
|
139
167
|
|
140
168
|
def internet_gateway(logical_id)
|
141
|
-
|
169
|
+
id = internet_gateway_ids[logical_id.to_sym]
|
170
|
+
@ec2.internet_gateways[id] if id
|
142
171
|
end
|
143
172
|
|
144
173
|
alias_method :igw, :internet_gateway
|
@@ -148,7 +177,8 @@ module AWS
|
|
148
177
|
end
|
149
178
|
|
150
179
|
def launch_configuration(logical_id)
|
151
|
-
|
180
|
+
id = launch_configuration_ids[logical_id.to_sym]
|
181
|
+
@as.launch_configurations[id] if id
|
152
182
|
end
|
153
183
|
|
154
184
|
alias_method :launch_config, :launch_configuration
|
@@ -164,7 +194,8 @@ module AWS
|
|
164
194
|
end
|
165
195
|
|
166
196
|
def network_interface(logical_id)
|
167
|
-
|
197
|
+
id = network_interface_ids[logical_id.to_sym]
|
198
|
+
@ec2.network_interfaces[id] if id
|
168
199
|
end
|
169
200
|
|
170
201
|
alias_method :nic, :network_interface
|
@@ -180,7 +211,8 @@ module AWS
|
|
180
211
|
end
|
181
212
|
|
182
213
|
def route_table(logical_id)
|
183
|
-
|
214
|
+
id = route_table_ids[logical_id.to_sym]
|
215
|
+
@ec2.route_tables[id] if id
|
184
216
|
end
|
185
217
|
|
186
218
|
def route_table_ids
|
@@ -189,8 +221,13 @@ module AWS
|
|
189
221
|
|
190
222
|
def scaling_policy(as_group_logical_id, policy_logical_id)
|
191
223
|
group = autoscaling_group(as_group_logical_id)
|
192
|
-
|
193
|
-
|
224
|
+
id = scaling_policy_ids[policy_logical_id.to_sym]
|
225
|
+
policy = id.split('/')[-1] unless id.nil?
|
226
|
+
if (group && policy)
|
227
|
+
AWS::AutoScaling::ScalingPolicy.new(group, policy)
|
228
|
+
else
|
229
|
+
nil
|
230
|
+
end
|
194
231
|
end
|
195
232
|
|
196
233
|
def scaling_policies(as_group_logical_id)
|
@@ -202,7 +239,8 @@ module AWS
|
|
202
239
|
end
|
203
240
|
|
204
241
|
def security_group(logical_id)
|
205
|
-
|
242
|
+
id = security_group_ids[logical_id.to_sym]
|
243
|
+
@ec2.security_groups.filter('group-id',id).first if id
|
206
244
|
end
|
207
245
|
|
208
246
|
def security_groups
|
@@ -214,7 +252,8 @@ module AWS
|
|
214
252
|
end
|
215
253
|
|
216
254
|
def subnet(logical_id)
|
217
|
-
|
255
|
+
id = subnet_ids[logical_id.to_sym]
|
256
|
+
@ec2.subnets[id] if id
|
218
257
|
end
|
219
258
|
|
220
259
|
def subnets
|
@@ -226,7 +265,8 @@ module AWS
|
|
226
265
|
end
|
227
266
|
|
228
267
|
def volume(logical_id)
|
229
|
-
|
268
|
+
id = volume_ids[logical_id.to_sym]
|
269
|
+
@ec2.volumes[id] if id
|
230
270
|
end
|
231
271
|
|
232
272
|
def volumes
|
@@ -238,7 +278,8 @@ module AWS
|
|
238
278
|
end
|
239
279
|
|
240
280
|
def vpc(logical_id)
|
241
|
-
|
281
|
+
id = vpc_ids[logical_id.to_sym]
|
282
|
+
@ec2.vpcs[id] if id
|
242
283
|
end
|
243
284
|
|
244
285
|
def vpcs
|
@@ -252,9 +293,7 @@ module AWS
|
|
252
293
|
private
|
253
294
|
|
254
295
|
def get_resources(resource_type)
|
255
|
-
hash =
|
256
|
-
resource_summaries.select { |rs| rs[:resource_type] == "#{resource_type}" }.collect { |r| hash[r[:logical_resource_id].to_sym] = r[:physical_resource_id] }
|
257
|
-
return hash
|
296
|
+
resource_summaries.select { |rs| rs[:resource_type] == "#{resource_type}" }.inject({}) { |hash, r| hash[r[:logical_resource_id].to_sym] = r[:physical_resource_id]; hash }
|
258
297
|
end
|
259
298
|
|
260
299
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-cfn-resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shayne Clausson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|