kumogata-template 0.0.19 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a072c9287be025226a5046066132716048ede1a2
4
- data.tar.gz: ccfe43986bc296bec97d755cce6f3f1bc96cf291
3
+ metadata.gz: ae44c5d6a8ef25cb9a1bddef8be090585ee044a0
4
+ data.tar.gz: fb27547765a960f1553286e050d80edf18f490e2
5
5
  SHA512:
6
- metadata.gz: 6f6e0278162a801dcb24ff85836fe6879b14f374926b42c91484405c46f468ba09a8adf58f5c52e1049453af70e65a89c408e1f20e2078202996cffce85a868d
7
- data.tar.gz: d78e60f26dd322470bada79d3884f134a4f1deb5c5e3826d5949ae64ff0e144a2a809be8d8147e0b51d4defdb2b37c908a3c1c7d11fe2c0284b6ecde970ea606
6
+ metadata.gz: 83d1c2e8e3d312bfccd564eda1502f74280027839640d43a4f575ef0f6c9f11529da3076ddd6c1f14b65738e8a2c77f34d57945baf3f6fb6d469dcc66252e0be
7
+ data.tar.gz: f942a22f5c2eeeb521c7f2c5382b07e7d17ebaa30bc9a57172432d2627f5ed35447ddaf5deec09c2986a8cd6faf78b9ca73d5ea5d1e5fc98741621d3f9096320
@@ -1,33 +1,33 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kumogata-template (0.0.18)
4
+ kumogata-template (0.0.19)
5
5
  aws-sdk (~> 2.3)
6
6
  kumogata (= 0.5.12)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- aws-sdk (2.7.10)
12
- aws-sdk-resources (= 2.7.10)
13
- aws-sdk-core (2.7.10)
11
+ aws-sdk (2.9.7)
12
+ aws-sdk-resources (= 2.9.7)
13
+ aws-sdk-core (2.9.7)
14
14
  aws-sigv4 (~> 1.0)
15
15
  jmespath (~> 1.0)
16
- aws-sdk-resources (2.7.10)
17
- aws-sdk-core (= 2.7.10)
18
- aws-sdk-v1 (1.66.0)
16
+ aws-sdk-resources (2.9.7)
17
+ aws-sdk-core (= 2.9.7)
18
+ aws-sdk-v1 (1.67.0)
19
19
  json (~> 1.4)
20
- nokogiri (>= 1.4.4)
20
+ nokogiri (~> 1)
21
21
  aws-sigv4 (1.0.0)
22
22
  coderay (1.1.1)
23
23
  coffee-script (2.4.1)
24
24
  coffee-script-source
25
25
  execjs
26
26
  coffee-script-source (1.12.2)
27
- diffy (3.1.0)
27
+ diffy (3.2.0)
28
28
  dslh (0.2.7)
29
29
  execjs (2.7.0)
30
- hashie (3.5.3)
30
+ hashie (3.5.5)
31
31
  highline (1.7.8)
32
32
  jmespath (1.3.1)
33
33
  json (1.8.3)
@@ -48,16 +48,16 @@ GEM
48
48
  term-ansicolor
49
49
  therubyracer (= 0.12.2)
50
50
  uuidtools
51
- libv8 (3.16.14.17)
51
+ libv8 (3.16.14.19)
52
52
  mini_portile2 (2.0.0)
53
53
  minitest (5.10.1)
54
- net-ssh (4.0.1)
54
+ net-ssh (4.1.0)
55
55
  nokogiri (1.6.7.2)
56
56
  mini_portile2 (~> 2.0.0.rc2)
57
57
  rake (11.3.0)
58
58
  ref (2.0.0)
59
59
  retryable (2.0.4)
60
- term-ansicolor (1.4.0)
60
+ term-ansicolor (1.5.0)
61
61
  tins (~> 1.0)
62
62
  therubyracer (0.12.2)
63
63
  libv8 (~> 3.16.14.0)
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2016 Naoya Nakazawa
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -11,6 +11,7 @@ require 'kumogata/template/datapipeline'
11
11
  require 'kumogata/template/dynamodb'
12
12
  require 'kumogata/template/ec2'
13
13
  require 'kumogata/template/ecs'
14
+ require 'kumogata/template/elasticache'
14
15
  require 'kumogata/template/elasticbeanstalk'
15
16
  require 'kumogata/template/elb'
16
17
  require 'kumogata/template/emr'
@@ -0,0 +1,30 @@
1
+ #
2
+ # Helper - ElastiCache
3
+ #
4
+ require 'kumogata/template/helper'
5
+
6
+ def _elasticache_to_engine(args)
7
+ _valid_values(args[:engine], %w( memcached redis ), ELASTICACHE_DEFAULT_ENGINE)
8
+ end
9
+
10
+ def _elasticache_to_node(args)
11
+ node = _ref_string("node", args, "cache node types")
12
+ if node.is_a? String
13
+ node = "cache.#{node}" if node !~ /cache./
14
+ node = _valid_values(node, ELASTICACHE_NODE_TYPES, ELASTICACHE_DEFAULT_NODE_TYPE)
15
+ end
16
+ node
17
+ end
18
+
19
+ def _elasticache_to_parameter(args)
20
+ engine = _elasticache_to_engine(args)
21
+ parameter = _ref_string("parameter", args, "cache parameter group")
22
+ if parameter.empty?
23
+ if engine == "memcached"
24
+ parameter = "default.memcached1.4"
25
+ else
26
+ parameter = "default.redis2.8"
27
+ end
28
+ end
29
+ parameter
30
+ end
@@ -1 +1 @@
1
- KUMOGATA_TEMPLATE_VERSION = '0.0.19'
1
+ KUMOGATA_TEMPLATE_VERSION = '0.0.20'
@@ -3,21 +3,14 @@
3
3
  # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html
4
4
  #
5
5
  require 'kumogata/template/helper'
6
+ require 'kumogata/template/elasticache'
6
7
 
7
8
  name = _resource_name(args[:name], "cache cluster")
8
- engine = _valid_values(args[:engine], %w( memcached redis ), ELASTICACHE_DEFAULT_ENGINE)
9
+ engine = _elasticache_to_engine(args)
9
10
  auto = _bool("auto", args, true)
10
11
  azmode = args[:azmode] || ""
11
- node = _ref_string("node", args, "cache node types")
12
- node = _valid_values(node, ELASTICACHE_NODE_TYPES, ELASTICACHE_DEFAULT_NODE_TYPE) unless node.is_a? Hash
13
- parameter = _ref_string("parameter", args, "cache parameter group")
14
- if parameter.empty?
15
- if engine == "memcached"
16
- parameter = "default.memcached1.4"
17
- else
18
- parameter = "default.redis2.8"
19
- end
20
- end
12
+ node = _elasticache_to_node(args)
13
+ parameter = _elasticache_to_parameter(args)
21
14
  subnet = _ref_string("subnet", args, "cache subnet group")
22
15
  cluster = _ref_name("cluster", args, "cache cluster")
23
16
  engine_version = _ref_string("engine_version", args, "cache engine version")
@@ -3,21 +3,14 @@
3
3
  # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html
4
4
  #
5
5
  require 'kumogata/template/helper'
6
+ require 'kumogata/template/elasticache'
6
7
 
7
8
  name = _resource_name(args[:name], "cache replication group")
8
- engine = _valid_values(args[:engine], %w( memcached redis ), ELASTICACHE_DEFAULT_ENGINE)
9
+ engine = _elasticache_to_engine(args)
9
10
  automatic = _bool("automatic", args, true)
10
11
  auto = _bool("auto", args, true)
11
- node = _ref_string("node", args, "cache node types")
12
- node = _valid_values(node, ELASTICACHE_NODE_TYPES, ELASTICACHE_DEFAULT_NODE_TYPE) unless node.is_a? Hash
13
- parameter = _ref_string("parameter", args, "cache parameter group")
14
- if parameter.empty?
15
- if engine == "memcached"
16
- parameter = "default.memcached1.4"
17
- else
18
- parameter = "default.redis2.8"
19
- end
20
- end
12
+ node = _elasticache_to_node(args)
13
+ parameter = _elasticache_to_parameter(args)
21
14
  subnet = _ref_string("subnet", args, "cache subnet group")
22
15
  engine_version = _ref_string("engine_version", args, "cache engine version")
23
16
  engine_version = ELASTICACHE_DEFAULT_ENGINE_VERSION[engine.to_sym] if engine_version.empty?
@@ -3,7 +3,10 @@
3
3
  #
4
4
  require 'kumogata/template/helper'
5
5
 
6
+ default = args[:cache_node] || ELASTICACHE_DEFAULT_NODE_TYPE
7
+ default = "cache.#{default}" if default !~ /cache./
8
+
6
9
  _parameter "#{args[:name]} cache node types",
7
- default: args[:cache_node] || ELASTICACHE_DEFAULT_NODE_TYPE,
10
+ default: default,
8
11
  description: "#{args[:name]} cache node types",
9
12
  allowed_values: ELASTICACHE_NODE_TYPES
@@ -0,0 +1,55 @@
1
+ require 'abstract_unit'
2
+ require 'kumogata/template/elasticache'
3
+
4
+ class ElastiCacheTest < Minitest::Test
5
+ def test_elasticache_to_engine
6
+ template = <<-EOS
7
+ Test _elasticache_to_engine({})
8
+ EOS
9
+ act_template = run_client_as_json(template)
10
+ exp_template = <<-EOS
11
+ {
12
+ "Test": "redis"
13
+ }
14
+ EOS
15
+ assert_equal exp_template.chomp, act_template
16
+ end
17
+
18
+ def test_elasticache_to_node
19
+ template = <<-EOS
20
+ Test _elasticache_to_node({})
21
+ EOS
22
+ act_template = run_client_as_json(template)
23
+ exp_template = <<-EOS
24
+ {
25
+ "Test": "cache.t2.medium"
26
+ }
27
+ EOS
28
+ assert_equal exp_template.chomp, act_template
29
+
30
+ template = <<-EOS
31
+ Test _elasticache_to_node(node: "r3.8xlarge")
32
+ EOS
33
+ act_template = run_client_as_json(template)
34
+ exp_template = <<-EOS
35
+ {
36
+ "Test": "cache.r3.8xlarge"
37
+ }
38
+ EOS
39
+ assert_equal exp_template.chomp, act_template
40
+ end
41
+
42
+ def test_elasticache_to_parameter
43
+ template = <<-EOS
44
+ Test _elasticache_to_parameter({})
45
+ EOS
46
+ act_template = run_client_as_json(template)
47
+ exp_template = <<-EOS
48
+ {
49
+ "Test": "default.redis2.8"
50
+ }
51
+ EOS
52
+ assert_equal exp_template.chomp, act_template
53
+ end
54
+ end
55
+
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.19
4
+ version: 0.0.20
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-03-24 00:00:00.000000000 Z
11
+ date: 2017-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -93,6 +93,7 @@ files:
93
93
  - ".travis.yml"
94
94
  - Gemfile
95
95
  - Gemfile.lock
96
+ - LICENSE.txt
96
97
  - README.md
97
98
  - Rakefile
98
99
  - bin/kumogata-template
@@ -111,6 +112,7 @@ files:
111
112
  - lib/kumogata/template/dynamodb.rb
112
113
  - lib/kumogata/template/ec2.rb
113
114
  - lib/kumogata/template/ecs.rb
115
+ - lib/kumogata/template/elasticache.rb
114
116
  - lib/kumogata/template/elasticbeanstalk.rb
115
117
  - lib/kumogata/template/elb.rb
116
118
  - lib/kumogata/template/emr.rb
@@ -258,6 +260,7 @@ files:
258
260
  - test/dynamodb_test.rb
259
261
  - test/ec2_test.rb
260
262
  - test/ecs_test.rb
263
+ - test/elasticache_test.rb
261
264
  - test/elasticbeanstalk_test.rb
262
265
  - test/elb_test.rb
263
266
  - test/emr_test.rb
@@ -425,6 +428,7 @@ test_files:
425
428
  - test/dynamodb_test.rb
426
429
  - test/ec2_test.rb
427
430
  - test/ecs_test.rb
431
+ - test/elasticache_test.rb
428
432
  - test/elasticbeanstalk_test.rb
429
433
  - test/elb_test.rb
430
434
  - test/emr_test.rb