kumogata-template 0.0.28 → 0.0.29

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 192abd8a01159a3a1373f2061dc56d8529b2f71b
4
- data.tar.gz: c71a1eb3841a68a38c001f6355f72b2293e5f0ce
3
+ metadata.gz: 3b7c5c58bc386eb269e5d341c8ebf017a35acfb4
4
+ data.tar.gz: fe355680255862807a561345d95d579b5d59714d
5
5
  SHA512:
6
- metadata.gz: 01c7bce4d0aaafbcacd82c837c284515839522062a96a30cffd3f61cdd1cb174f799330ed4ddfaf5fa31a0e3e382fc8b03be48bb7534ee02d9ad28c6368dbb86
7
- data.tar.gz: b4bdd068aa9b8d3a8be2eca82dce10eeb6c00cc1192aea2807a82a865495cbeebee987db76620d0e89884295d9f8491645161df50c281391bc1ac418e544eee6
6
+ metadata.gz: f199fc4f72e2a341e97aa94eacc362143dc33f8a5a959c77c28881caddf909c380c2dfac5bdf4c4c76bcb2bc1f5ecae4dd3d5a4a941dce512e099c4a9ccc3a79
7
+ data.tar.gz: 38306ede34739c5a85b4a200fa123f408bc33683ebc2ac6a3baf2e077a82e12663c336147b79b58ae8dc8f1df103666330654692ac664ce24e5f362d64eb2f89
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kumogata-template (0.0.27)
4
+ kumogata-template (0.0.28)
5
5
  aws-sdk (~> 2.3)
6
6
  kumogata (= 0.5.12)
7
7
 
@@ -48,7 +48,7 @@ GEM
48
48
  term-ansicolor
49
49
  therubyracer (= 0.12.2)
50
50
  uuidtools
51
- libv8 (3.16.14.19)
51
+ libv8 (3.16.14.19-x86_64-darwin-16)
52
52
  mini_portile2 (2.0.0)
53
53
  minitest (5.10.2)
54
54
  net-ssh (4.1.0)
@@ -75,4 +75,4 @@ DEPENDENCIES
75
75
  rake (~> 11.1)
76
76
 
77
77
  BUNDLED WITH
78
- 1.14.6
78
+ 1.15.0
@@ -200,6 +200,10 @@ def _iam_arn(service, resource)
200
200
  (args.size == 1) ? array.first : array
201
201
  end
202
202
 
203
+ def _convert_resource(args)
204
+ (args.size == 1) ? args.first : args
205
+ end
206
+
203
207
  arn_prefix = "arn:aws:#{service}"
204
208
  case service
205
209
  when "s3"
@@ -236,29 +240,51 @@ def _iam_arn(service, resource)
236
240
  if resource == "*"
237
241
  resource
238
242
  else
239
- resource = [ { region: resource[:region], account_id: resource[:account_id], stack: resource[:stack] } ] if resource.is_a? String
240
- resource.collect{|v| "#{arn_prefix}:#{v[:region]}:#{v[:account_id]}:stack/#{v[:stack]}" }
243
+ resource = [ resource ] if resource.is_a? Hash
244
+ resource.collect!{|v| "#{arn_prefix}:#{v[:region]}:#{v[:account_id]}:stack/#{v[:stack]}" }
245
+ _convert_resource(resource)
241
246
  end
242
247
 
243
248
  when "iam"
244
- if resource.key? :sts
245
- "arn:aws:sts::#{resource[:account_id]}:#{resource[:type]}/#{resource[:user]}"
246
- elsif resource.key? :policy
247
- "arn:aws:iam::aws:policy/#{_iam_to_policy(resource[:policy])}"
248
- elsif resource.key? :root
249
- "#{arn_prefix}::#{resource[:account_id]}:root"
250
- else
251
- "#{arn_prefix}::#{resource[:account_id]}:#{resource[:type]}/#{resource[:user]}"
249
+ resource = [ resource ] if resource.is_a? Hash
250
+ resource.collect! do |v|
251
+ if v.key? :sts
252
+ "arn:aws:sts::#{v[:account_id]}:#{v[:type]}/#{v[:user]}"
253
+ elsif v.key? :policy
254
+ "arn:aws:iam::aws:policy/#{_iam_to_policy(v[:policy])}"
255
+ elsif v.key? :root
256
+ "#{arn_prefix}::#{v[:account_id]}:root"
257
+ else
258
+ "#{arn_prefix}::#{v[:account_id]}:#{v[:type]}/#{v[:user]}"
259
+ end
252
260
  end
261
+ _convert_resource(resource)
253
262
 
254
263
  when "elasticloadbalancing"
255
- resource.collect{|v| "#{arn_prefix}:*:*:loadbalancer/#{v}" }
264
+ resource = [ resource ] if resource.is_a? String
265
+ resource.collect!{|v| "#{arn_prefix}:*:*:loadbalancer/#{v}" }
266
+ _convert_resource(resource)
256
267
 
257
268
  when "logs"
258
269
  "#{arn_prefix}:*:*:*"
259
270
 
260
271
  when "kinesis"
261
- "#{arn_prefix}:#{resource[:region]}:#{resource[:account_id]}:#{resource[:type]}/#{resource[:name]}"
272
+ resource = [ resource ] if resource.is_a? Hash
273
+ resource.collect!{|v| "#{arn_prefix}:#{v[:region]}:#{v[:account_id]}:#{v[:type]}/#{v[:name]}" }
274
+ _convert_resource(resource)
275
+
276
+ when "lambda"
277
+ resource = [ resource ] if resource.is_a? Hash
278
+ resource.collect! do |v|
279
+ v[:type] = "function" unless v.key? :type
280
+ "#{arn_prefix}:#{v[:region]}:#{v[:account_id]}:#{v[:type]}:#{v[:name]}"
281
+ end
282
+ _convert_resource(resource)
283
+
284
+ when "ses"
285
+ resource = [ resource ] if resource.is_a? String
286
+ resource.collect!{|v| "#{arn_prefix}:#{v}" }
287
+ _convert_resource(resource)
262
288
  end
263
289
  end
264
290
 
@@ -1 +1 @@
1
- KUMOGATA_TEMPLATE_VERSION = '0.0.28'
1
+ KUMOGATA_TEMPLATE_VERSION = '0.0.29'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kumogata-template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.28
4
+ version: 0.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naoya Nakazawa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-26 00:00:00.000000000 Z
11
+ date: 2017-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -415,7 +415,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
415
415
  version: '0'
416
416
  requirements: []
417
417
  rubyforge_project:
418
- rubygems_version: 2.6.11
418
+ rubygems_version: 2.5.2
419
419
  signing_key:
420
420
  specification_version: 4
421
421
  summary: Template for Kumogata.