applb 0.1.3 → 0.1.4

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: 76977cb0b63d4f3572d0ff7af1460ec6116aeb37
4
- data.tar.gz: 449a558ea0fa16f405f84a4512feb8b36efcc2e5
3
+ metadata.gz: 86fee79fad0f566fda95a3cf048d5a46c1a223b8
4
+ data.tar.gz: 67f3349fb1f006771309674e89ef7f0dd259a38d
5
5
  SHA512:
6
- metadata.gz: 0cacc6a8c1e732e679de433090dc199a3cef88f35eebecca1a8df0306f9f25c464947dd81d15e3890acaa1ba0a17f51c429de42db1d9e9c134376f15d368891e
7
- data.tar.gz: 122a8a8538e0e3efed0d99d52a0ff29b0bb3c7499b7b1eec62c3628d65b8e60c2e460e6f8a724681a3ba7f0661bb63b3aa1d4356feabc75e9b83e8d9e568aa21
6
+ metadata.gz: 18ffb205d52bc0566cc404ed5fae54a68193b479d4305588967a6ade7bf5370ccf11dea585b135c0ffeb2ef623821d6a0945cece2f0e94956cffc1990059138f
7
+ data.tar.gz: b8487809f7eadb685e143490516d4c336881b89705926b32b21d3c10ec3e78ab7505250badf270abc2a484aa049b53150f219d85d6e57f193a7a1353c27a872f
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Applb
2
2
 
3
- [![Build Status](https://travis-ci.org/wata-gh/applb.svg)](https://travis-ci.org/wata-gh/applb)
3
+ [![Build Status](https://travis-ci.org/codenize-tools/applb.svg)](https://travis-ci.org/codenize-tools/applb)
4
4
 
5
5
  Applb is a tool to manage ELB v2(ALB).
6
6
  It defines the state of ELB v2(ALB) using DSL, and updates ELB v2(ALB) according to DSL.
@@ -238,7 +238,7 @@ end
238
238
 
239
239
  ## Test
240
240
 
241
- set your AWS arn for [spec/aws_config.yml.sample](https://github.com/wata-gh/applb/blob/master/spec/aws_config.yml.sample) and rename to spec/aws_config.yml.
241
+ set your AWS arn for [spec/aws_config.yml.sample](https://github.com/codenize-tools/applb/blob/master/spec/aws_config.yml.sample) and rename to spec/aws_config.yml.
242
242
 
243
243
  ## Similar tools
244
244
 
@@ -246,7 +246,7 @@ set your AWS arn for [spec/aws_config.yml.sample](https://github.com/wata-gh/app
246
246
 
247
247
  ## Contributing
248
248
 
249
- Bug reports and pull requests are welcome on GitHub at https://github.com/wata-gh/applb.
249
+ Bug reports and pull requests are welcome on GitHub at https://github.com/codenize-tools/applb.
250
250
 
251
251
 
252
252
  ## License
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{Codenize ELB v2 (ALB)}
13
13
  spec.description = %q{Manage ALB by DSL}
14
- spec.homepage = 'http://github.com/wata-gh/applb'
14
+ spec.homepage = 'https://github.com/codenize-tools/applb'
15
15
  spec.license = 'MIT'
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ['lib']
23
23
 
24
- spec.add_dependency 'aws-sdk', '~> 2'
24
+ spec.add_dependency 'aws-sdk-elasticloadbalancingv2', '>= 1.6.0'
25
25
  spec.add_dependency 'hashie'
26
26
  spec.add_dependency 'diffy'
27
27
  spec.add_dependency 'term-ansicolor'
@@ -369,9 +369,9 @@ module Applb
369
369
  when 'access_logs.s3.enabled' then
370
370
  (result['access_logs'] ||= {s3: {}})[:s3][:enabled] = attr.value
371
371
  when 'access_logs.s3.prefix' then
372
- result['access_logs'] ||= {s3: {}}[:s3][:prefix] = attr.value
372
+ (result['access_logs'] ||= {s3: {}})[:s3][:prefix] = attr.value
373
373
  when 'access_logs.s3.bucket' then
374
- result['access_logs'] ||= {s3: {}}[:s3][:bucket] = attr.value
374
+ (result['access_logs'] ||= {s3: {}})[:s3][:bucket] = attr.value
375
375
  else
376
376
  result[attr.key] = attr.value
377
377
  end
@@ -1,5 +1,5 @@
1
1
  require 'forwardable'
2
- require 'aws-sdk'
2
+ require 'aws-sdk-elasticloadbalancingv2'
3
3
 
4
4
  module Applb
5
5
  class ClientWrapper
@@ -40,6 +40,7 @@ module Applb
40
40
  begin
41
41
  resp = @client.describe_target_groups(*argv)
42
42
  results.push(*resp.target_groups)
43
+ next_marker = resp.next_marker
43
44
  end while next_marker
44
45
  results
45
46
  end
@@ -50,6 +51,7 @@ module Applb
50
51
  begin
51
52
  resp = @client.describe_listeners(*argv)
52
53
  results.push(*resp.listeners)
54
+ next_marker = resp.next_marker
53
55
  end while next_marker
54
56
  results
55
57
  end
@@ -60,6 +62,7 @@ module Applb
60
62
  begin
61
63
  resp = @client.describe_rules(*argv)
62
64
  results.push(*resp.rules)
65
+ next_marker = resp.next_marker
63
66
  end while next_marker
64
67
  results
65
68
  end
@@ -11,7 +11,7 @@ module Applb
11
11
  ATTRIBUTES = %i/
12
12
  name protocol port vpc_id health_check_protocol health_check_port health_check_path
13
13
  health_check_interval_seconds health_check_timeout_seconds healthy_threshold_count
14
- unhealthy_threshold_count matcher
14
+ unhealthy_threshold_count matcher target_type
15
15
  /
16
16
 
17
17
  attr_accessor *ATTRIBUTES
@@ -43,6 +43,10 @@ module Applb
43
43
 
44
44
  Applb.logger.info("Modify target group #{name}")
45
45
  Applb.logger.info("<diff>\n#{Applb::Utils.diff(aws_hash, dsl_hash, color: @options[:color])}")
46
+ if unmodifiable_attributes_updated?(dsl_hash, aws_hash)
47
+ raise 'Can not modify unmodifiable attributes.'
48
+ end
49
+
46
50
  return if @options[:dry_run]
47
51
 
48
52
  client.modify_target_group(modify_option).target_groups.first
@@ -54,13 +58,24 @@ module Applb
54
58
  to_h
55
59
  end
56
60
 
57
- UNMODIFIABLE_ATTRIBUTES = %i/name port protocol vpc_id/
61
+ UNMODIFIABLE_ATTRIBUTES = %i/name port protocol vpc_id target_type/
58
62
  def modify_option
59
63
  options = to_h.
60
64
  merge(target_group_arn: @aws_tg.target_group_arn).
61
65
  reject! { |k, v| UNMODIFIABLE_ATTRIBUTES.include?(k) }
62
66
  end
63
67
 
68
+ def unmodifiable_attributes_updated?(dsl_hash, aws_hash)
69
+ updated = false
70
+ UNMODIFIABLE_ATTRIBUTES.each do |n|
71
+ if dsl_hash[n] != aws_hash[n]
72
+ updated = true
73
+ Applb.logger.error("can not modify target_group `#{n}'")
74
+ end
75
+ end
76
+ updated
77
+ end
78
+
64
79
  def to_diff_h
65
80
  hash = to_h
66
81
  hash.delete(:target_group_arn)
@@ -85,6 +100,7 @@ module Applb
85
100
  @lb_name = lb_name
86
101
  @result = Result.new(@context)
87
102
  @result.name = name
103
+ @result.target_type = 'instance' # default value
88
104
 
89
105
  instance_eval(&block)
90
106
  end
@@ -147,6 +163,10 @@ module Applb
147
163
  def matcher(http_code:)
148
164
  @result.matcher = { http_code: http_code }
149
165
  end
166
+
167
+ def target_type(target_type)
168
+ @result.target_type = target_type
169
+ end
150
170
  end
151
171
  end
152
172
  end
@@ -1,3 +1,3 @@
1
1
  module Applb
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: applb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - wata
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-23 00:00:00.000000000 Z
11
+ date: 2017-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: aws-sdk
14
+ name: aws-sdk-elasticloadbalancingv2
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '2'
19
+ version: 1.6.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '2'
26
+ version: 1.6.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: hashie
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -165,7 +165,7 @@ files:
165
165
  - lib/applb/template_helper.rb
166
166
  - lib/applb/utils.rb
167
167
  - lib/applb/version.rb
168
- homepage: http://github.com/wata-gh/applb
168
+ homepage: https://github.com/codenize-tools/applb
169
169
  licenses:
170
170
  - MIT
171
171
  metadata: {}
@@ -185,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  version: '0'
186
186
  requirements: []
187
187
  rubyforge_project:
188
- rubygems_version: 2.5.2
188
+ rubygems_version: 2.6.13
189
189
  signing_key:
190
190
  specification_version: 4
191
191
  summary: Codenize ELB v2 (ALB)